com.continuent.tungsten.common.directory
Class ResourceNode

java.lang.Object
  extended by com.continuent.tungsten.common.directory.ResourceNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

public class ResourceNode
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable

Version:
1.0
Author:
Ed Archibald
See Also:
Serialized Form

Field Summary
 java.util.Map<java.lang.String,ResourceNode> children
           
 ResourceNode parent
           
 
Constructor Summary
ResourceNode(Resource resource)
           
 
Method Summary
 ResourceNode addChild(Resource child)
          Utility method that creates a new resource node from the resource passed in and then adds it as a child.
 void addChild(ResourceNode childNode)
          Adds a child node to this node
 int compareTo(java.lang.Object comp)
           
 java.util.Map<java.lang.String,ResourceNode> getChildren()
          Return a map of the current children of this node or an empty map.
 ResourceType getChildType()
           
 java.lang.String getKey()
           
 int getNumberOfChildren()
          Returns the number of immediate children of this Node.
 ResourceNode getParent()
           
 Resource getResource()
           
 ResourceNode getRoot()
           
 ResourceType getType()
           
 boolean isContainer()
           
 boolean isExecutable()
           
 void removeChild(java.lang.String key)
          Remove a child by key
 void setChildren(java.util.Map<java.lang.String,ResourceNode> children)
           
 void setParent(ResourceNode parent)
           
 void setResource(Resource resource)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

children

public java.util.Map<java.lang.String,ResourceNode> children

parent

public ResourceNode parent
Constructor Detail

ResourceNode

public ResourceNode(Resource resource)
Parameters:
resource -
Method Detail

getResource

public Resource getResource()
Returns:
the resource held by this node

getType

public ResourceType getType()
Returns:
the type of this node

getChildType

public ResourceType getChildType()
Returns:
the allowed type for children of this node

getKey

public java.lang.String getKey()
Returns:
the key for this node

isContainer

public boolean isContainer()
Returns:
true if this node can contain other resources, otherwise false

isExecutable

public boolean isExecutable()
Returns:
true if the resource for this node is executable, otherwise false

getChildren

public java.util.Map<java.lang.String,ResourceNode> getChildren()
Return a map of the current children of this node or an empty map.

Returns:
the children of Node

setChildren

public void setChildren(java.util.Map<java.lang.String,ResourceNode> children)
Parameters:
children -

getNumberOfChildren

public int getNumberOfChildren()
Returns the number of immediate children of this Node.

Returns:
the number of immediate children.

addChild

public void addChild(ResourceNode childNode)
Adds a child node to this node

Parameters:
childNode -

addChild

public ResourceNode addChild(Resource child)
Utility method that creates a new resource node from the resource passed in and then adds it as a child.

Parameters:
child -
Returns:
the new node created/added as a result of this method

removeChild

public void removeChild(java.lang.String key)
Remove a child by key

Parameters:
key -

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getParent

public ResourceNode getParent()

setParent

public void setParent(ResourceNode parent)

getRoot

public ResourceNode getRoot()

setResource

public void setResource(Resource resource)

compareTo

public int compareTo(java.lang.Object comp)
Specified by:
compareTo in interface java.lang.Comparable