ninja.activeproxy.path.description
Class ElementDescription

java.lang.Object
  |
  +--ninja.activeproxy.path.description.ElementDescription
Direct Known Subclasses:
ConnectorDescription, DataTypeDescription, IODescription, OperatorDescription, PathDescription, ProtocolDescription, RuntimeDescription

public abstract class ElementDescription
extends java.lang.Object
implements Tags, java.io.Serializable

Representation of an XML description. Somewhat simple representation of XML description (few public methods provided in ElementDescription) because the goal is to allow other classes to extend ElementDescription and implement runtime descriptions of different objects (operators, connectors, etc.), while abstracting away the fact that descriptions for these objects are written in XML. This class is abstract, which will force the instantiation of child classes.

See Also:
Serialized Form

Field Summary
private  java.util.Hashtable attributes
           
private  java.util.Vector children
           
private  java.lang.String type
           
 
Fields inherited from interface ninja.activeproxy.path.description.Tags
CLASSNAME, CONNECTOR, DATATYPE, DESTINATION, ID, INPUT, NAME, OPERATOR, OPERATOR_PATH_INDEX, OPERATOR_SELECTED, OUTPUT, PATH, PROTOCOL, PROTOCOL_ORDERED, PROTOCOL_RELIABLE, PROTOCOL_TYPE, RUNTIME, RUNTIME_HOST, SOURCE, URL
 
Constructor Summary
ElementDescription(java.lang.String type)
          Constructs an empty element of the given type.
 
Method Summary
protected  void addChild(ElementDescription child)
          Adds a child to this element.
protected  void addChildren(java.util.Vector children)
          Adds children to this element.
 java.util.Enumeration getAllAttributes()
          Returns an enumeration of all attribute names of this element.
 java.lang.String getAttr(java.lang.String name)
          Returns the value of an attribute.
protected  java.util.Vector getChildren()
          Returns all children of this element.
protected  java.util.Vector getChildrenByType(java.lang.String type)
          Returns all children of the given type.
 java.lang.String getType()
          Returns the type of this element.
protected  boolean removeChild(ElementDescription child)
          Removes a child from this element.
protected  java.util.Vector removeChildrenByType(java.lang.String type)
          Removes all children of the given type.
 void setAttr(java.lang.String name, java.lang.String value)
          Sets an attribute to the given value.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

type

private java.lang.String type

attributes

private java.util.Hashtable attributes

children

private java.util.Vector children
Constructor Detail

ElementDescription

public ElementDescription(java.lang.String type)
Constructs an empty element of the given type.
Parameters:
type - the type of the element.
Method Detail

getType

public java.lang.String getType()
Returns the type of this element.
Returns:
the type of this element.

setAttr

public void setAttr(java.lang.String name,
                    java.lang.String value)
Sets an attribute to the given value.
Parameters:
name - the name of the attribute.
value - the value of the attribute.

getAttr

public java.lang.String getAttr(java.lang.String name)
Returns the value of an attribute.
Parameters:
name - the name of the attribute.
Returns:
the value of the attribute.

getAllAttributes

public java.util.Enumeration getAllAttributes()
Returns an enumeration of all attribute names of this element.
Returns:
an enumeration of all attribute names of this element.

addChild

protected void addChild(ElementDescription child)
Adds a child to this element.
Parameters:
child - the child to be added.

addChildren

protected void addChildren(java.util.Vector children)
Adds children to this element.
Parameters:
children - a vector of children to be added to this element.

removeChild

protected boolean removeChild(ElementDescription child)
Removes a child from this element.
Parameters:
child - the child to be removed.
Returns:
true if the argument was a child of this element; false, otherwise.

removeChildrenByType

protected java.util.Vector removeChildrenByType(java.lang.String type)
Removes all children of the given type.
Parameters:
type - the type of children to be removed.
Returns:
vector of removed children.

getChildren

protected java.util.Vector getChildren()
Returns all children of this element.
Returns:
a vector containing all children of this element.

getChildrenByType

protected java.util.Vector getChildrenByType(java.lang.String type)
Returns all children of the given type.
Parameters:
type - the type of the children to be retrieved.
Returns:
a vector containing all children of the given type.