Rice Pastry API

rice.p2p.scribe
Class ScribeImpl.TopicManager

java.lang.Object
  extended by rice.p2p.scribe.ScribeImpl.TopicManager
All Implemented Interfaces:
java.util.Observer, Destructable
Enclosing class:
ScribeImpl

public class ScribeImpl.TopicManager
extends java.lang.Object
implements java.util.Observer, Destructable

Class which keeps track of a given topic

Version:
$Id: ScribeImpl.java 3650 2007-03-18 19:33:01Z jeffh $
Author:
amislove

Field Summary
protected  java.util.ArrayList children
          DESCRIBE THE FIELD
protected  java.util.ArrayList clients
          DESCRIBE THE FIELD
protected  NodeHandle parent
          DESCRIBE THE FIELD
protected  Id[] pathToRoot
          The current path to the root for this node
protected  Topic topic
          DESCRIBE THE FIELD
 
Constructor Summary
protected ScribeImpl.TopicManager(Topic topic)
          Constructor for TopicManager.
  ScribeImpl.TopicManager(Topic topic, NodeHandle child)
          Constructor for TopicManager.
  ScribeImpl.TopicManager(Topic topic, ScribeClient client)
          Constructor for TopicManager.
 
Method Summary
 void addChild(NodeHandle child)
          Adds a feature to the Child attribute of the TopicManager object
 void addClient(ScribeClient client)
          Adds a feature to the Client attribute of the TopicManager object
 boolean containsChild(NodeHandle child)
           
 boolean containsClient(ScribeClient client)
          Returns whether or not this topic manager contains the given client.
 void destroy()
           
 NodeHandle[] getChildren()
          Gets the Children attribute of the TopicManager object
 ScribeClient[] getClients()
          Gets the Clients attribute of the TopicManager object
 NodeHandle getParent()
          Gets the Parent attribute of the TopicManager object
 Id[] getPathToRoot()
          Gets the PathToRoot attribute of the TopicManager object
 Topic getTopic()
          Gets the topic of the TopicManager object
 int numChildren()
           
 boolean removeChild(NodeHandle child)
          Removes the child from the topic.
 boolean removeClient(ScribeClient client)
          DESCRIBE THE METHOD
 void setParent(NodeHandle handle)
          Sets the Parent attribute of the TopicManager object
 void setPathToRoot(Id[] pathToRoot)
          Sets the PathToRoot attribute of the TopicManager object
 java.lang.String toString()
           
 void update(java.util.Observable o, java.lang.Object arg)
          Called when a Node's liveness changes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

topic

protected Topic topic
DESCRIBE THE FIELD


pathToRoot

protected Id[] pathToRoot
The current path to the root for this node


clients

protected java.util.ArrayList clients
DESCRIBE THE FIELD


children

protected java.util.ArrayList children
DESCRIBE THE FIELD


parent

protected NodeHandle parent
DESCRIBE THE FIELD

Constructor Detail

ScribeImpl.TopicManager

public ScribeImpl.TopicManager(Topic topic,
                               ScribeClient client)
Constructor for TopicManager.

Parameters:
topic - DESCRIBE THE PARAMETER
client - DESCRIBE THE PARAMETER

ScribeImpl.TopicManager

public ScribeImpl.TopicManager(Topic topic,
                               NodeHandle child)
Constructor for TopicManager.

Parameters:
topic - DESCRIBE THE PARAMETER
child - DESCRIBE THE PARAMETER

ScribeImpl.TopicManager

protected ScribeImpl.TopicManager(Topic topic)
Constructor for TopicManager.

Parameters:
topic - DESCRIBE THE PARAMETER
Method Detail

getTopic

public Topic getTopic()
Gets the topic of the TopicManager object

Returns:
The Parent value

getParent

public NodeHandle getParent()
Gets the Parent attribute of the TopicManager object

Returns:
The Parent value

getClients

public ScribeClient[] getClients()
Gets the Clients attribute of the TopicManager object

Returns:
The Clients value

containsClient

public boolean containsClient(ScribeClient client)
Returns whether or not this topic manager contains the given client.

Parameters:
client - The client in question
Returns:
Whether or not this manager contains the client

getChildren

public NodeHandle[] getChildren()
Gets the Children attribute of the TopicManager object

Returns:
The Children value

numChildren

public int numChildren()

getPathToRoot

public Id[] getPathToRoot()
Gets the PathToRoot attribute of the TopicManager object

Returns:
The PathToRoot value

setPathToRoot

public void setPathToRoot(Id[] pathToRoot)
Sets the PathToRoot attribute of the TopicManager object

Parameters:
pathToRoot - The new PathToRoot value

setParent

public void setParent(NodeHandle handle)
Sets the Parent attribute of the TopicManager object

Parameters:
handle - The new Parent value

toString

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

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Called when a Node's liveness changes

Specified by:
update in interface java.util.Observer

addClient

public void addClient(ScribeClient client)
Adds a feature to the Client attribute of the TopicManager object

Parameters:
client - The feature to be added to the Client attribute

removeClient

public boolean removeClient(ScribeClient client)
DESCRIBE THE METHOD

Parameters:
client - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

containsChild

public boolean containsChild(NodeHandle child)

addChild

public void addChild(NodeHandle child)
Adds a feature to the Child attribute of the TopicManager object

Parameters:
child - The feature to be added to the Child attribute

removeChild

public boolean removeChild(NodeHandle child)
Removes the child from the topic.

Parameters:
child - the child to be removed
Returns:
true if we can unsubscribe (IE, no clients nor children)

destroy

public void destroy()
Specified by:
destroy in interface Destructable

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.