Rice Pastry API

rice.p2p.scribe
Class ScribeImpl.TopicManager

java.lang.Object
  extended by rice.p2p.scribe.ScribeImpl.TopicManager
Enclosing class:
ScribeImpl

public class ScribeImpl.TopicManager
extends java.lang.Object

Class which keeps track of a given topic

Version:
$Id: ScribeImpl.java 4495 2008-09-26 14:48:02Z jeffh $
Author:
amislove

Field Summary
protected  java.util.ArrayList<NodeHandle> children
          DESCRIBE THE FIELD
protected  java.util.ArrayList<ScribeMultiClient> clients
          DESCRIBE THE FIELD
protected  NodeHandle parent
          DESCRIBE THE FIELD
protected  java.util.List<Id> pathToRoot
          The current path to the root for this node
protected  Topic topic
          DESCRIBE THE FIELD
 
Method Summary
 void addChild(NodeHandle child)
          Adds a feature to the Child attribute of the TopicManager object Need to be holding lock: topicManagers
 void addClient(ScribeMultiClient client)
          Adds a feature to the Client attribute of the TopicManager object
 boolean containsChild(NodeHandle child)
           
 boolean containsClient(ScribeMultiClient client)
          Returns whether or not this topic manager contains the given client.
 java.util.Collection<NodeHandle> getChildren()
          Gets the Children attribute of the TopicManager object
 java.util.Collection<ScribeMultiClient> getClients()
          Gets the Clients attribute of the TopicManager object
 NodeHandle getParent()
          Gets the Parent attribute of the TopicManager object
 java.util.List<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(ScribeMultiClient client)
           
 void setParent(NodeHandle handle, java.util.List<Id> pathToRoot)
          Sets the Parent attribute of the TopicManager object
 void setPathToRoot(java.util.List<Id> pathToRoot)
          Sets the PathToRoot attribute of the TopicManager object Don't hold the topicManagers lock, this method sends messages
 java.lang.String toString()
           
 
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 java.util.List<Id> pathToRoot
The current path to the root for this node


clients

protected java.util.ArrayList<ScribeMultiClient> clients
DESCRIBE THE FIELD


children

protected java.util.ArrayList<NodeHandle> children
DESCRIBE THE FIELD


parent

protected NodeHandle parent
DESCRIBE THE FIELD

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 java.util.Collection<ScribeMultiClient> getClients()
Gets the Clients attribute of the TopicManager object

Returns:
The Clients value

containsClient

public boolean containsClient(ScribeMultiClient 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 java.util.Collection<NodeHandle> getChildren()
Gets the Children attribute of the TopicManager object

Returns:
The Children value

numChildren

public int numChildren()

getPathToRoot

public java.util.List<Id> getPathToRoot()
Gets the PathToRoot attribute of the TopicManager object

Returns:
The PathToRoot value

setPathToRoot

public void setPathToRoot(java.util.List<Id> pathToRoot)
Sets the PathToRoot attribute of the TopicManager object Don't hold the topicManagers lock, this method sends messages

Parameters:
pathToRoot - The new PathToRoot value

setParent

public void setParent(NodeHandle handle,
                      java.util.List<Id> pathToRoot)
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

addClient

public void addClient(ScribeMultiClient 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(ScribeMultiClient client)
Parameters:
client - the client to remove
Returns:
true if there are no children/clients remaining (you can unsubscribe from the parent)

containsChild

public boolean containsChild(NodeHandle child)

addChild

public void addChild(NodeHandle child)
Adds a feature to the Child attribute of the TopicManager object Need to be holding lock: topicManagers

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

removeChild

public boolean removeChild(NodeHandle child)
Removes the child from the topic. Need to be holding lock: topicManagers

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

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection