All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface uhr.core.structure.Node

public interface Node
This interface represents a single node in a hierarchical System Tree. Each node has one part, so this tree defines the plugpoints available for parts to fill.

A node can have a container or leaf part. Containers hold zero or more nodes. The terms part and node are fairly interchangable.

Responsibilites are to maintain the state that applies to the plugpoint structure only. This is the node's name, part, and parent node. That's all. The design philosophy is a Node should remain small and simple, serving only a "plugpoint structure role", with nearly no behavior.

But name, part and parent node are not enough. The systen or tool designer will eventually need to associate various properties with parts. Rather than have the part carry that data, or a custom parallel tree structure carry it, a Node has simple named properties.

Properties are used by core parts or tools, and possible a few domain parts. A basic set of "abilities" is all the core needs. The keys for these all start with "core." Other properties should have a differnt key namespace. The basic abilities are described in Node Basic Abilities.

We hope we haven't opened up a Pandora's Box with Node properties. They are to be used wisely. :-)


Method Index

 o getName()
Returns the part name.
 o getParentNode()
Returns the node's parent node or null if this is the root.
 o getPart()
Returns the node's part.
 o getProperty(String)
Returns the property with the name or null if not found.
 o getPropertyNames()
Returns an Enumeration of all the property names.
 o getRootNode()
Returns the root node, which has no parent node.
 o hasProperty(String)
Determines whether the node has the named property.
 o removeProperty(String)
Removes the property with the name.
 o setName(String)
Sets the node or part name.
 o setParentNode(Node)
Sets the node's parent node.
 o setPart(Object)
Sets the node's part, which may be any object whatsoever.
 o setProperty(String, Object)
Sets the property using the name and value.
 o toString()
Returns a String representation of the node.

Methods

 o setName
 public abstract void setName(String name)
Sets the node or part name. This must be unique per container. It must be alphanumeric, may contain periods, and must not contain blanks or slashes. It cannot be null or a zero length String. This is a required property.

The name "MyCell" is not allowed. This is reserved for use in Cell.findPart(String name).

Our convention is to capatalize the first letter of each word making up the self-documenting part name. Examples are "Root", "ControlRegistry" and "UserSecurity".

If part names are used for finding the part in other containers, then to avoid name space conflicts the names need careful design. This can achieve branch or system uniqueness. This will happen if service parts are used a lot. To support unique naming we allow periods in the name, such as "org.jcon.security.UserAuthorization".

Parameters:
name - the name of the node.
 o getName
 public abstract String getName()
Returns the part name.

Returns:
the name of the part.
 o setPart
 public abstract void setPart(Object part)
Sets the node's part, which may be any object whatsoever. The object should be unique per container and probably unique per System Tree. This is a required property.

If the part implements NodeUser then setNode(Node) will be called, using "this" node.

Parameters:
part - the node's part.
 o getPart
 public abstract Object getPart()
Returns the node's part.

Returns:
the node's part.
 o setParentNode
 public abstract void setParentNode(Node parentNode)
Sets the node's parent node. This is required for all nodes in a tree except the root, which is null.

Parameters:
parentNode - the parent of this node or null if this is the root node.
 o getParentNode
 public abstract Node getParentNode()
Returns the node's parent node or null if this is the root.

Returns:
the parent of this node or null if this is the root node.
 o hasProperty
 public abstract boolean hasProperty(String name)
Determines whether the node has the named property. Note that often the property value is not needed, just whether the node has it or not.

Parameters:
name - the property's name.
Returns:
true if the node has the property, false if not.
 o setProperty
 public abstract Object setProperty(String name,
                                    Object value)
Sets the property using the name and value.

Parameters:
name - the property name.
value - the property value, which cannot be null.
Returns:
the previous value for the name or null if none.
 o removeProperty
 public abstract Object removeProperty(String name)
Removes the property with the name.

Parameters:
name - the property name.
Returns:
the value removed or null if none.
 o getProperty
 public abstract Object getProperty(String name)
Returns the property with the name or null if not found.

Parameters:
name - the property name of interest.
Returns:
the property with the name or null if not found.
 o getPropertyNames
 public abstract Enumeration getPropertyNames()
Returns an Enumeration of all the property names.

Returns:
the Enumeration of all the property names.
 o getRootNode
 public abstract Node getRootNode()
Returns the root node, which has no parent node.

Returns:
the root node.
 o toString
 public abstract String toString()
Returns a String representation of the node. The standard is the name of the node.

Returns:
a String representation of the node.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index