|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.excalibur.configuration.CascadingConfiguration
The CascadingConfiguration is a classic Configuration backed by parent Configuration. Operations such as getChild return a CascadingConfiguration encapsulating both a primary and parent configuration. Requests for attribute values are resolved against the base configuration initially. If the result of the resolution is unsucessful, the request is applied against the parent configuration. As a parent may also be a CascadingConfiguration, the evaluation will be applied until a value is resolved against a class parent Configuration.
| Constructor Summary | |
CascadingConfiguration(Configuration base,
Configuration parent)
Create a CascadingConfiguration with specified parent. |
|
| Method Summary | |
String |
getAttribute(String paramName)
Return the value of specified attribute. |
String |
getAttribute(String name,
String defaultValue)
Returns the value of the attribute specified by its name as a String, or the default value if no attribute by
that name exists or is empty. |
boolean |
getAttributeAsBoolean(String paramName)
Return the boolean value of the specified parameter contained
in this node. |
boolean |
getAttributeAsBoolean(String name,
boolean defaultValue)
Returns the value of the attribute specified by its name as a boolean, or the default value if no attribute by
that name exists or is empty. |
float |
getAttributeAsFloat(String paramName)
Return the float value of the specified parameter contained
in this node. |
float |
getAttributeAsFloat(String name,
float defaultValue)
Returns the value of the attribute specified by its name as a float, or the default value if no attribute by
that name exists or is empty. |
int |
getAttributeAsInteger(String paramName)
Return the int value of the specified attribute contained
in this node or the parent. |
int |
getAttributeAsInteger(String name,
int defaultValue)
Returns the value of the attribute specified by its name as a int, or the default value if no attribute by
that name exists or is empty. |
long |
getAttributeAsLong(String name)
Returns the value of the attribute specified by its name as a long. |
long |
getAttributeAsLong(String name,
long defaultValue)
Returns the value of the attribute specified by its name as a long, or the default value if no attribute by
that name exists or is empty. |
String[] |
getAttributeNames()
Return an array of all attribute names in both base and parent. |
Configuration |
getChild(String child)
Return a new CascadingConfiguration instance encapsulating the
specified child node of the base and parent node. |
Configuration |
getChild(String child,
boolean createNew)
Return a Configuration instance encapsulating the specified
child node. |
Configuration[] |
getChildren()
Return an Array of Configuration
elements containing all node children of both base and parent configurations. |
Configuration[] |
getChildren(String name)
Return an Array of Configuration
elements containing all node children with the specified name from
both base and parent configurations. |
String |
getLocation()
Return a string describing location of the base Configuration. |
String |
getName()
Return the name of the base node. |
String |
getNamespace()
Returns the namespace the main Configuration node belongs to. |
String |
getValue()
Return the String value of the node. |
String |
getValue(String defaultValue)
Returns the value of the configuration element as a String. |
boolean |
getValueAsBoolean()
Return the boolean value of the node. |
boolean |
getValueAsBoolean(boolean defaultValue)
Returns the value of the configuration element as a boolean. |
float |
getValueAsFloat()
Return the float value of the node. |
float |
getValueAsFloat(float defaultValue)
Returns the value of the configuration element as a float. |
int |
getValueAsInteger()
Return the int value of the node. |
int |
getValueAsInteger(int defaultValue)
Returns the value of the configuration element as an int. |
long |
getValueAsLong()
Return the long value of the node. |
long |
getValueAsLong(long defaultValue)
Returns the value of the configuration element as a long. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public CascadingConfiguration(Configuration base,
Configuration parent)
base - the base Configurationparent - the parent Configuration| Method Detail |
public String getName()
getName in interface ConfigurationConfiguration node.public String getLocation()
getLocation in interface Configuration
public String getNamespace()
throws ConfigurationException
getNamespace in interface ConfigurationConfigurationException - may be thrown by the underlying configurationpublic Configuration getChild(String child)
CascadingConfiguration instance encapsulating the
specified child node of the base and parent node.
getChild in interface Configurationchild - The name of the child node.
public Configuration getChild(String child,
boolean createNew)
Configuration instance encapsulating the specified
child node.
getChild in interface Configurationchild - The name of the child node.createNew - If true, a new Configuration
will be created and returned if the specified child does not exist in either
the base or parent configuratioin. If false, null
will be returned when the specified child doesn't exist in either the base or
the parent.
public Configuration[] getChildren()
Array of Configuration
elements containing all node children of both base and parent configurations.
The array order will reflect the order in the source config file, commencing
with the base configuration.
getChildren in interface Configurationpublic Configuration[] getChildren(String name)
Array of Configuration
elements containing all node children with the specified name from
both base and parent configurations. The array
order will reflect the order in the source config file commencing
with the base configuration.
getChildren in interface Configurationname - The name of the children to get.
namepublic String[] getAttributeNames()
The order of attributes in this array can not be relied on. As
with XML, a Configuration's attributes are an
unordered set. If your code relies on order, eg
conf.getAttributeNames()[0], then it is liable to break if a
different XML parser is used.
getAttributeNames in interface Configuration
public String getAttribute(String paramName)
throws ConfigurationException
getAttribute in interface ConfigurationparamName - The name of the parameter you ask the value of.
ConfigurationException - If no attribute with that name exists.
public int getAttributeAsInteger(String paramName)
throws ConfigurationException
int value of the specified attribute contained
in this node or the parent.
getAttributeAsInteger in interface ConfigurationparamName - The name of the parameter you ask the value of.
ConfigurationException - If no parameter with that name exists.
or if conversion to int fails.
public long getAttributeAsLong(String name)
throws ConfigurationException
long.
getAttributeAsLong in interface Configurationname - The name of the parameter you ask the value of.
ConfigurationException - If no parameter with that name exists.
or if conversion to long fails.
public float getAttributeAsFloat(String paramName)
throws ConfigurationException
float value of the specified parameter contained
in this node.
getAttributeAsFloat in interface ConfigurationparamName - The name of the parameter you ask the value of.
ConfigurationException - If no parameter with that name exists.
or if conversion to float fails.
public boolean getAttributeAsBoolean(String paramName)
throws ConfigurationException
boolean value of the specified parameter contained
in this node.
getAttributeAsBoolean in interface ConfigurationparamName - The name of the parameter you ask the value of.
ConfigurationException - If no parameter with that name exists.
or if conversion to boolean fails.
public String getValue()
throws ConfigurationException
String value of the node.
getValue in interface ConfigurationConfigurationException - May be raised by underlying
base or parent configuration.
public int getValueAsInteger()
throws ConfigurationException
int value of the node.
getValueAsInteger in interface ConfigurationConfigurationException - If conversion to int fails.
public float getValueAsFloat()
throws ConfigurationException
float value of the node.
getValueAsFloat in interface ConfigurationConfigurationException - If conversion to float fails.
public boolean getValueAsBoolean()
throws ConfigurationException
boolean value of the node.
getValueAsBoolean in interface ConfigurationConfigurationException - If conversion to boolean fails.
public long getValueAsLong()
throws ConfigurationException
long value of the node.
getValueAsLong in interface ConfigurationConfigurationException - If conversion to long fails.public String getValue(String defaultValue)
String.
If the configuration value is not set, the default value will be
used.
getValue in interface ConfigurationdefaultValue - The default value desired.
Configuration, or default
if none specified.public int getValueAsInteger(int defaultValue)
int.
If the configuration value is not set, the default value will be
used.
getValueAsInteger in interface ConfigurationdefaultValue - The default value desired.
Configuration, or default
if none specified.public long getValueAsLong(long defaultValue)
long.
If the configuration value is not set, the default value will be
used.
getValueAsLong in interface ConfigurationdefaultValue - The default value desired.
Configuration, or default
if none specified.public float getValueAsFloat(float defaultValue)
float.
If the configuration value is not set, the default value will be
used.
getValueAsFloat in interface ConfigurationdefaultValue - The default value desired.
Configuration, or default
if none specified.public boolean getValueAsBoolean(boolean defaultValue)
boolean.
If the configuration value is not set, the default value will be
used.
getValueAsBoolean in interface ConfigurationdefaultValue - The default value desired.
Configuration, or default
if none specified.
public String getAttribute(String name,
String defaultValue)
String, or the default value if no attribute by
that name exists or is empty.
getAttribute in interface Configurationname - The name of the attribute you ask the value of.defaultValue - The default value desired.
public int getAttributeAsInteger(String name,
int defaultValue)
int, or the default value if no attribute by
that name exists or is empty.
getAttributeAsInteger in interface Configurationname - The name of the attribute you ask the value of.defaultValue - The default value desired.
public long getAttributeAsLong(String name,
long defaultValue)
long, or the default value if no attribute by
that name exists or is empty.
getAttributeAsLong in interface Configurationname - The name of the attribute you ask the value of.defaultValue - The default value desired.
public float getAttributeAsFloat(String name,
float defaultValue)
float, or the default value if no attribute by
that name exists or is empty.
getAttributeAsFloat in interface Configurationname - The name of the attribute you ask the value of.defaultValue - The default value desired.
public boolean getAttributeAsBoolean(String name,
boolean defaultValue)
boolean, or the default value if no attribute by
that name exists or is empty.
getAttributeAsBoolean in interface Configurationname - The name of the attribute you ask the value of.defaultValue - The default value desired.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||