Rice Pastry API

rice.scribe.testing
Class BasicScribeRegrTestApp

java.lang.Object
  |
  +--rice.scribe.testing.BasicScribeRegrTestApp
All Implemented Interfaces:
IScribeApp

public class BasicScribeRegrTestApp
extends java.lang.Object
implements IScribeApp

Version:
$Id: BasicScribeRegrTestApp.java,v 1.12 2003/02/11 17:56:25 atuls Exp $
Author:
Romer Gil

Constructor Summary
BasicScribeRegrTestApp(rice.pastry.PastryNode node, rice.scribe.Scribe scribe, int app, rice.pastry.security.Credentials cred)
           
 
Method Summary
 void anycast(rice.pastry.NodeId topicId)
          direct call to scribe for anycasting to a topic from the current node.
 boolean anycastHandler(rice.scribe.messaging.ScribeMessage msg)
          up-call invoked by Scribe when an anycast message is being handled.
 void create(rice.pastry.NodeId topicId)
          direct call to scribe for creating a topic from the current node.
 void faultHandler(rice.scribe.messaging.ScribeMessage msg, rice.pastry.NodeHandle parent)
          up-call invoked by scribe when a node detects a failure from its parent.
 void forwardHandler(rice.scribe.messaging.ScribeMessage msg)
          up-call invoked by scribe when a publish message is forwarded through the multicast tree.
 rice.pastry.NodeId generateTopicId(java.lang.String topicName)
           
 rice.pastry.NodeId getNodeId()
           
 void isNewRoot(rice.pastry.NodeId topicId)
          Upcall by scribe to let this application know that it is the new root.
 void join(rice.pastry.NodeId topicId)
          direct call to scribe for subscribing to a topic from the current node.
 void leave(rice.pastry.NodeId topicId)
          direct call to scribe for unsubscribing a topic from the current node The topic is chosen randomly if null is passed and topics exist.
 void multicast(rice.pastry.NodeId topicId)
          direct call to scribe for publishing to a topic from the current node.
 void newParent(rice.pastry.NodeId topicId, rice.pastry.NodeHandle newParent, java.io.Serializable data)
          Upcall by scribe to let this application know about local node's new parent in the topic tree
 void putTopic(rice.pastry.NodeId tid)
          Let's the current node know about a topic created in the whole scribe network.
 void receiveMessage(rice.scribe.messaging.ScribeMessage msg)
          up-call invoked by scribe when a publish message is 'delivered'.
 void scribeIsReady()
          Invoked when the underlying Scribe substrate is ready.
 void subscribeHandler(rice.pastry.NodeId topicId, rice.pastry.NodeHandle child, boolean wasAdded, java.io.Serializable obj)
          up-call invoked by scribe when a node is added/removed to the multicast tree.
 boolean verifyApplication(java.util.List topics, rice.scribe.testing.MRTracker trk, rice.scribe.testing.MRTracker trkAfter)
          This makes sure that if the current app was subscribed to a topic, it received all the messages published to it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicScribeRegrTestApp

public BasicScribeRegrTestApp(rice.pastry.PastryNode node,
                              rice.scribe.Scribe scribe,
                              int app,
                              rice.pastry.security.Credentials cred)
Method Detail

verifyApplication

public boolean verifyApplication(java.util.List topics,
                                 rice.scribe.testing.MRTracker trk,
                                 rice.scribe.testing.MRTracker trkAfter)
This makes sure that if the current app was subscribed to a topic, it received all the messages published to it.


scribeIsReady

public void scribeIsReady()
Description copied from interface: IScribeApp
Invoked when the underlying Scribe substrate is ready. The Scribe substrate becomes ready as soon as the local Pastry node on which it lies is ready. In order to get this upcall it is necessary that the IScribeApp registers itself to the Scribe substrate using the registerApp() method in IScribe interface.

Specified by:
scribeIsReady in interface IScribeApp

receiveMessage

public void receiveMessage(rice.scribe.messaging.ScribeMessage msg)
up-call invoked by scribe when a publish message is 'delivered'.

Specified by:
receiveMessage in interface IScribeApp
Parameters:
msg - The message sent in the PUBLISH message.

forwardHandler

public void forwardHandler(rice.scribe.messaging.ScribeMessage msg)
up-call invoked by scribe when a publish message is forwarded through the multicast tree.

Specified by:
forwardHandler in interface IScribeApp
Parameters:
msg - The message about to be forwarded.

anycastHandler

public boolean anycastHandler(rice.scribe.messaging.ScribeMessage msg)
up-call invoked by Scribe when an anycast message is being handled.

Specified by:
anycastHandler in interface IScribeApp
Parameters:
msg - The corresponding Anycast message
Returns:
Whether local application was able to satisfy the request of anycast message.

faultHandler

public void faultHandler(rice.scribe.messaging.ScribeMessage msg,
                         rice.pastry.NodeHandle parent)
up-call invoked by scribe when a node detects a failure from its parent.

Specified by:
faultHandler in interface IScribeApp
Parameters:
msg - The SUBSCRIBE message that is sent to repair the multicast tree.
parent - The suspected faulty parent.

subscribeHandler

public void subscribeHandler(rice.pastry.NodeId topicId,
                             rice.pastry.NodeHandle child,
                             boolean wasAdded,
                             java.io.Serializable obj)
up-call invoked by scribe when a node is added/removed to the multicast tree.

Specified by:
subscribeHandler in interface IScribeApp
Parameters:
topicId - The topic for which child was added or removed.
child - The corresponding child.
wasAdded - true if child was added and false if child was removed.
obj - The additional data associated with the subscription message, SUBSCRIBE msg, sent by the "original" child, not the forwarding node.

generateTopicId

public rice.pastry.NodeId generateTopicId(java.lang.String topicName)

getNodeId

public rice.pastry.NodeId getNodeId()

create

public void create(rice.pastry.NodeId topicId)
direct call to scribe for creating a topic from the current node.


multicast

public void multicast(rice.pastry.NodeId topicId)
direct call to scribe for publishing to a topic from the current node.


anycast

public void anycast(rice.pastry.NodeId topicId)
direct call to scribe for anycasting to a topic from the current node.


join

public void join(rice.pastry.NodeId topicId)
direct call to scribe for subscribing to a topic from the current node.


leave

public void leave(rice.pastry.NodeId topicId)
direct call to scribe for unsubscribing a topic from the current node The topic is chosen randomly if null is passed and topics exist.


putTopic

public void putTopic(rice.pastry.NodeId tid)
Let's the current node know about a topic created in the whole scribe network. This is not used for any other purposes than just verifying after the regr test that all messages to all topics where received.


isNewRoot

public void isNewRoot(rice.pastry.NodeId topicId)
Upcall by scribe to let this application know that it is the new root.

Specified by:
isNewRoot in interface IScribeApp
Parameters:
topicId - The topic for which local node is the new root.

newParent

public void newParent(rice.pastry.NodeId topicId,
                      rice.pastry.NodeHandle newParent,
                      java.io.Serializable data)
Upcall by scribe to let this application know about local node's new parent in the topic tree

Specified by:
newParent in interface IScribeApp
Parameters:
topicId - The topic for which new parent is found
newParent - The new parent
data - The data received with the ACK message.

Rice Pastry API

Copyright © 2001 - Rice Pastry.


Imprint-Dataprotection