|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectplanet.scribe.ScribeImpl
The provided implementation of Scribe.
Nested Class Summary | |
class |
ScribeImpl.TopicManager
Class which keeps track of a given topic |
Field Summary | |
protected EndPoint |
endpoint
this application's endpoint |
protected NodeHandle |
handle
the local node handle |
static long |
MESSAGE_TIMEOUT
the timeout for a subscribe message |
protected ScribePolicy |
policy
this scribe's policy |
java.util.Hashtable |
topics
the hashtable of topic -> TopicManager |
Constructor Summary | |
ScribeImpl(java.lang.String appId)
Constructor for Scribe, using the default policy. |
|
ScribeImpl(java.lang.String appId,
ScribePolicy policy)
Constructor for Scribe |
Method Summary | |
void |
addChild(Topic topic,
NodeHandle child)
Adds a child to the given topic |
void |
anycast(Topic topic,
ScribeContent content)
Anycasts the given content to a member of the given topic |
void |
byStep()
An upcall to inform this Application for a new step. |
void |
deliver(Id id,
Message message)
This method is called on the application at the destination node for the given id. |
boolean |
forward(Message message)
This method is invoked on applications when the underlying node is about to forward the given message with the provided target to the specified next hop. |
NodeHandle[] |
getChildren(Topic topic)
Returns the list of children for a given topic |
ScribeClient[] |
getClients(Topic topic)
Returns the list of clients for a given topic |
java.lang.String |
getId()
Returns the Id of the application |
Id |
getNodeId()
Returns the Id of the local node |
NodeHandle |
getParent(Topic topic)
Returns the parent for a given topic |
ScribePolicy |
getPolicy()
Returns the current policy for this scribe object |
boolean |
isRoot(Topic topic)
Returns whether or not this Scribe is the root for the given topic |
void |
publish(Topic topic,
ScribeContent content)
Publishes the given message to the topic. |
void |
removeChild(Topic topic,
NodeHandle child)
Removes a child from the given topic |
protected void |
removeChild(Topic topic,
NodeHandle child,
boolean sendDrop)
Removes a child from the given topic |
void |
setEndPoint(EndPoint endpoint)
Sets the EndPoint which permits communicate with underlying node. |
void |
setId(java.lang.String appId)
Sets the identification of this application. |
void |
setPolicy(ScribePolicy policy)
Sets the current policy for this scribe object |
Application |
setValues(java.lang.String applicationName)
Sets the name for this applicaton. |
void |
subscribe(Topic topic,
ScribeClient client)
Subscribes the given client to the provided topic. |
void |
subscribe(Topic topic,
ScribeClient client,
ScribeContent content)
Subscribes the given client to the provided topic. |
void |
unsubscribe(Topic topic,
ScribeClient client)
Unsubscribes the given client from the provided topic. |
void |
update(NodeHandle handle,
boolean joined)
This method is invoked to inform the application that the given node has either joined or left the neighbor set of the local node, as the set would be returned by the neighborSet call. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static long MESSAGE_TIMEOUT
public java.util.Hashtable topics
protected ScribePolicy policy
protected EndPoint endpoint
protected NodeHandle handle
Constructor Detail |
public ScribeImpl(java.lang.String appId)
appId
- Application namepublic ScribeImpl(java.lang.String appId, ScribePolicy policy)
appId
- Application namepolicy
- The policy for this ScribeMethod Detail |
public void byStep()
byStep
in interface Application
public void setEndPoint(EndPoint endpoint)
Application
setEndPoint
in interface Application
endpoint
- EndPoint to contact that knows how talk with
underlying node.public ScribePolicy getPolicy()
getPolicy
in interface Scribe
public void setPolicy(ScribePolicy policy)
setPolicy
in interface Scribe
policy
- The current policy for this scribepublic Id getNodeId()
public java.lang.String getId()
getId
in interface Application
public void setId(java.lang.String appId)
setId
in interface Application
appId
- Identification of this application.public ScribeClient[] getClients(Topic topic)
topic
- The topic to return the clients of
public NodeHandle[] getChildren(Topic topic)
getChildren
in interface Scribe
topic
- The topic to return the children of
public NodeHandle getParent(Topic topic)
topic
- The topic to return the parent of
public boolean isRoot(Topic topic)
isRoot
in interface Scribe
topic
- The topic in question
public void subscribe(Topic topic, ScribeClient client)
subscribe
in interface Scribe
topic
- The topic to subscribe toclient
- The client to give messages topublic void subscribe(Topic topic, ScribeClient client, ScribeContent content)
subscribe
in interface Scribe
topic
- The topic to subscribe toclient
- The client to give messages tocontent
- The content to include in the subscribepublic void unsubscribe(Topic topic, ScribeClient client)
unsubscribe
in interface Scribe
topic
- The topic to unsubscribe fromclient
- The client to unsubscribepublic void publish(Topic topic, ScribeContent content)
publish
in interface Scribe
topic
- The topic to publish tocontent
- The content to publishpublic void anycast(Topic topic, ScribeContent content)
anycast
in interface Scribe
topic
- The topic to anycast tocontent
- The content to anycastpublic void addChild(Topic topic, NodeHandle child)
addChild
in interface Scribe
topic
- The topic to add the child tochild
- The child to addpublic void removeChild(Topic topic, NodeHandle child)
removeChild
in interface Scribe
topic
- The topic to remove the child fromchild
- The child to removeprotected void removeChild(Topic topic, NodeHandle child, boolean sendDrop)
topic
- The topic to remove the child fromchild
- The child to removesendDrop
- Whether or not to send a drop message to the chilpublic boolean forward(Message message)
forward
in interface Application
message
- The message being sent, containing an internal message along with a destination
key and nodeHandle next hop.
public void deliver(Id id, Message message)
deliver
in interface Application
id
- The destination id of the messagemessage
- The message being sentpublic void update(NodeHandle handle, boolean joined)
update
in interface Application
handle
- The handle that has joined/leftjoined
- Whether the node has joined or leftpublic Application setValues(java.lang.String applicationName)
setValues
in interface Application
applicationName
- Name for this application.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |