public interface

ConfigurationElement

implements Cloneable
com.microstrategy.utils.config.ConfigurationElement
Known Indirect Subclasses

Class Overview

This is the base interface used by those classes that represent a configuration element, that is, a class that can be configured using an external file. Each configuration element is basically made off from:

  1. a node name
  2. a list of attributes (string values)
  3. a list of child configuration elements.
This interface defines the methods to access these properties. It also defines a getKey() method, which is used to uniquely identified this element among its siblings. As an example, take the following xml-definition in a configuration file:

 <a att0="0" att1="0">
   <b att="0" />

   <d name="d0" att="0" />
   <d name="d1" att="1"/>
   <d name="d2" att="2" />
 </a>
 
"a" will have 2 attributes (att0 and att1) and 4 child-elements (b, d, d, d).
"b" can be accessed with getElement("b"). The list of "d" elements can be accessed with getList("d"). Notice that getElement("d") will return a single ConfigurationElement whose elements are "d0" through "d2".

Summary

Public Methods
abstract ConfigurationValue getAttribute(String name)
Returns the value associated with the given attribute.
abstract HashList getAttributes()
Returns the list of all attributes available to this ConfigurationElement.
abstract ConfigurationElement getElement(Object nodeName)
Returns the ConfigurationElement instance associated with the given nodeName.
abstract HashList getElements()
Returns the list of all child-elements available to this ConfigurationElement.
abstract Object getKey()
This method is used to uniquely identify this ConfigurationElement within a list.
abstract String getNodeName()
Returns the node-name for this element.
abstract String getStrAttribute(String name)
abstract void initFromXML(Node root)
Initializes the object with information from an XML Node.
abstract void reload()
Triggers the re-initialization of the element and its children if the configuration files have changed.
abstract Element toXML(Document doc)
Utility method to get the object's XML representation.

Public Methods

public abstract ConfigurationValue getAttribute (String name)

Returns the value associated with the given attribute. If the attribute was not present in the xml configuration the method returns null. If multiple ElementSources are defined for this element, it returns the value of the one with greater priority.

public abstract HashList getAttributes ()

Returns the list of all attributes available to this ConfigurationElement.

public abstract ConfigurationElement getElement (Object nodeName)

Returns the ConfigurationElement instance associated with the given nodeName. If the ConfigurationElement was not present in the xml configuration, this method shall return an empty instance of the ConfigurationElement. If a list is associated with the given nodeName, this method returns an instance a single ConfigurationElement whose children are the ConfigurationElement instances for that nodeName. If no ConfigurationElement is associated with the given nodeName, the method returns null.

public abstract HashList getElements ()

Returns the list of all child-elements available to this ConfigurationElement.

public abstract Object getKey ()

This method is used to uniquely identify this ConfigurationElement within a list. Typically this is mapped to the value of a single attribute, but this is not necessary as each ConfigurationElement can define its own schema.

If it's not possible to uniquely identify this object, this method should return null.

Returns
  • The value representing the key of this object, null if there is no key available.

public abstract String getNodeName ()

Returns the node-name for this element.

public abstract String getStrAttribute (String name)

public abstract void initFromXML (Node root)

Initializes the object with information from an XML Node.

Parameters
root Node intance representing the configuration element properties

public abstract void reload ()

Triggers the re-initialization of the element and its children if the configuration files have changed.

public abstract Element toXML (Document doc)

Utility method to get the object's XML representation.

Parameters
doc Document object where the new element will be created from.
Returns
  • an XML Element instance of the object being represented