Rice Pastry API

rice.scribe.testing
Class DirectScribeMaintenanceTestApp

java.lang.Object
  |
  +--rice.scribe.testing.DirectScribeMaintenanceTestApp
All Implemented Interfaces:
IScribeApp, IScribeObserver

public class DirectScribeMaintenanceTestApp
extends java.lang.Object
implements IScribeApp, IScribeObserver

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

Field Summary
 java.util.Hashtable joinData
           
 int m_appCount
           
 rice.scribe.Scribe m_scribe
           
 
Constructor Summary
DirectScribeMaintenanceTestApp(rice.pastry.PastryNode node, rice.scribe.Scribe scribe, rice.pastry.security.Credentials cred)
          Constructor
 
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.
 java.lang.Object getJoinData(rice.pastry.NodeId topicId)
           
 rice.pastry.NodeHandle getLocalHandle()
           
 rice.pastry.NodeId getNodeId()
           
 rice.scribe.Scribe getScribe()
          Returns the underlying scribe object.
 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 join(rice.pastry.NodeId topicId, java.io.Serializable obj)
          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 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.
 void update(java.lang.Object obj)
          Method called by underlying scribe whenever a topic object is created impliclity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_scribe

public rice.scribe.Scribe m_scribe

m_appCount

public int m_appCount

joinData

public java.util.Hashtable joinData
Constructor Detail

DirectScribeMaintenanceTestApp

public DirectScribeMaintenanceTestApp(rice.pastry.PastryNode node,
                                      rice.scribe.Scribe scribe,
                                      rice.pastry.security.Credentials cred)
Constructor

Parameters:
node - The local PastryNode
scribe - The underlying scribe
cred - The credentials
Method Detail

getScribe

public rice.scribe.Scribe getScribe()
Returns the underlying scribe object.

Returns:
The underlying scribe object.

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.

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.

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.


join

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


join

public void join(rice.pastry.NodeId topicId,
                 java.io.Serializable obj)
direct call to scribe for subscribing to a topic from the current node. additional data can be sent along with subscription message


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.


anycast

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


getLocalHandle

public rice.pastry.NodeHandle getLocalHandle()

update

public void update(java.lang.Object obj)
Method called by underlying scribe whenever a topic object is created impliclity.

Specified by:
update in interface IScribeObserver
Parameters:
obj - The topicId.

getJoinData

public java.lang.Object getJoinData(rice.pastry.NodeId topicId)

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