Rice Pastry API

rice.scribe.testing
Class DistScribeRegrTestApp

java.lang.Object
  |
  +--rice.pastry.client.PastryAppl
        |
        +--rice.scribe.testing.DistScribeRegrTestApp
All Implemented Interfaces:
IScribeApp, MessageReceiver

public class DistScribeRegrTestApp
extends PastryAppl
implements IScribeApp

Version:
$Id: DistScribeRegrTestApp.java,v 1.17 2003/02/11 17:56:25 atuls Exp $
Author:
Atul Singh, Animesh Nandi

Field Summary
protected static rice.pastry.messaging.Address m_address
          The receiver address for the DistScribeApp system.
static int m_appCount
           
 int m_appIndex
           
protected static rice.pastry.security.Credentials m_credentials
          The Credentials object to be used for all messaging through Pastry
 rice.scribe.testing.DistScribeRegrTest m_driver
           
 java.util.Hashtable m_logTable
          The hashtable maintaining mapping from topicId to log object maintained by this application for that topic.
protected  rice.pastry.PastryNode m_pastryNode
           
 java.util.Random m_rng
           
 rice.scribe.Scribe m_scribe
           
protected  rice.pastry.routing.SendOptions m_sendOptions
          The SendOptions object to be used for all messaging through Pastry
 java.util.Vector m_topics
           
 
Fields inherited from class rice.pastry.client.PastryAppl
address, instance, thePastryNode
 
Constructor Summary
DistScribeRegrTestApp(rice.pastry.PastryNode pn, rice.scribe.Scribe scribe, rice.pastry.security.Credentials cred, rice.scribe.testing.DistScribeRegrTest driver)
           
 
Method Summary
 void anycast(rice.pastry.NodeId topicId, java.io.Serializable data)
          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.messaging.Address getAddress()
          Returns the address of this application.
 rice.pastry.security.Credentials getCredentials()
          Returns the credentials of this application.
 rice.scribe.Scribe getScribe()
           
 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 messageForAppl(rice.pastry.messaging.Message msg)
          Called by pastry when a message arrives for this application.
 void multicast(rice.pastry.NodeId topicId, java.io.Serializable data)
          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 processLog(rice.pastry.NodeId topicId, int new_seqno)
           
 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.
 
Methods inherited from class rice.pastry.client.PastryAppl
enrouteMessage, getLeafSet, getNodeHandle, getNodeId, getRoutingTable, isClosest, leafSetChange, notifyReady, receiveMessage, registerReceiver, routeMsg, routeMsgDirect, routeSetChange, sendMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_pastryNode

protected rice.pastry.PastryNode m_pastryNode

m_scribe

public rice.scribe.Scribe m_scribe

m_appIndex

public int m_appIndex

m_appCount

public static int m_appCount

m_rng

public java.util.Random m_rng

m_logTable

public java.util.Hashtable m_logTable
The hashtable maintaining mapping from topicId to log object maintained by this application for that topic.


m_address

protected static rice.pastry.messaging.Address m_address
The receiver address for the DistScribeApp system.


m_sendOptions

protected rice.pastry.routing.SendOptions m_sendOptions
The SendOptions object to be used for all messaging through Pastry


m_credentials

protected static rice.pastry.security.Credentials m_credentials
The Credentials object to be used for all messaging through Pastry


m_topics

public java.util.Vector m_topics

m_driver

public rice.scribe.testing.DistScribeRegrTest m_driver
Constructor Detail

DistScribeRegrTestApp

public DistScribeRegrTestApp(rice.pastry.PastryNode pn,
                             rice.scribe.Scribe scribe,
                             rice.pastry.security.Credentials cred,
                             rice.scribe.testing.DistScribeRegrTest driver)
Method Detail

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

getScribe

public rice.scribe.Scribe getScribe()

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.

processLog

public void processLog(rice.pastry.NodeId topicId,
                       int new_seqno)

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.

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.

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.

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.

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,
                      java.io.Serializable data)
direct call to scribe for publishing to a topic from the current node.


anycast

public void anycast(rice.pastry.NodeId topicId,
                    java.io.Serializable data)
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.


getCredentials

public rice.pastry.security.Credentials getCredentials()
Description copied from class: PastryAppl
Returns the credentials of this application.

Specified by:
getCredentials in class PastryAppl
Returns:
the credentials.

getAddress

public rice.pastry.messaging.Address getAddress()
Description copied from class: PastryAppl
Returns the address of this application.

Overrides:
getAddress in class PastryAppl
Returns:
the address.

messageForAppl

public void messageForAppl(rice.pastry.messaging.Message msg)
Description copied from class: PastryAppl
Called by pastry when a message arrives for this application.

Specified by:
messageForAppl in class PastryAppl
Parameters:
msg - the message that is arriving.

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