Rice Pastry API

rice.tutorial.lesson6
Class MyScribeClient

java.lang.Object
  extended byrice.tutorial.lesson6.MyScribeClient
All Implemented Interfaces:
Application, ScribeClient

public class MyScribeClient
extends java.lang.Object
implements ScribeClient, Application

We implement the Application interface to receive regular timed messages (see lesson5). We implement the ScribeClient interface to receive scribe messages (called ScribeContent).

Version:
$Id: pretty.settings 2305 2005-03-11 20:22:33Z jeffh $
Author:
Jeff Hoye

Field Summary
protected  Endpoint endpoint
          The Endpoint represents the underlieing node.
 
Constructor Summary
MyScribeClient(Node node)
          The constructor for this scribe client.
 
Method Summary
 boolean anycast(Topic topic, ScribeContent content)
          Called when we receive an anycast.
 void childAdded(Topic topic, NodeHandle child)
          DESCRIBE THE METHOD
 void childRemoved(Topic topic, NodeHandle child)
          DESCRIBE THE METHOD
 void deliver(Id id, Message message)
          Part of the Application interface.
 void deliver(Topic topic, ScribeContent content)
          Called whenever we receive a published message.
 boolean forward(RouteMessage message)
          DESCRIBE THE METHOD
 NodeHandle[] getChildren()
          Gets the Children attribute of the MyScribeClient object
 NodeHandle getParent()
          Gets the Parent attribute of the MyScribeClient object
 boolean isRoot()
          Some passthrough accessors for the myScribe ************
 void sendAnycast()
          Sends an anycast message.
 void sendMulticast()
          Sends the multicast message.
 void startPublishTask()
          Starts the publish task.
 void subscribe()
          Subscribes to myTopic.
 void subscribeFailed(Topic topic)
          DESCRIBE THE METHOD
 void update(NodeHandle handle, boolean joined)
          DESCRIBE THE METHOD
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

endpoint

protected Endpoint endpoint
The Endpoint represents the underlieing node. By making calls on the Endpoint, it assures that the message will be delivered to a MyApp on whichever node the message is intended for.

Constructor Detail

MyScribeClient

public MyScribeClient(Node node)
The constructor for this scribe client. It will construct the ScribeApplication.

Parameters:
node - the PastryNode
Method Detail

isRoot

public boolean isRoot()
Some passthrough accessors for the myScribe ************

Returns:
The Root value

getParent

public NodeHandle getParent()
Gets the Parent attribute of the MyScribeClient object

Returns:
The Parent value

getChildren

public NodeHandle[] getChildren()
Gets the Children attribute of the MyScribeClient object

Returns:
The Children value

subscribe

public void subscribe()
Subscribes to myTopic.


startPublishTask

public void startPublishTask()
Starts the publish task.


deliver

public void deliver(Id id,
                    Message message)
Part of the Application interface. Will receive PublishContent every so often.

Specified by:
deliver in interface Application
Parameters:
id - DESCRIBE THE PARAMETER
message - DESCRIBE THE PARAMETER

sendMulticast

public void sendMulticast()
Sends the multicast message.


deliver

public void deliver(Topic topic,
                    ScribeContent content)
Called whenever we receive a published message.

Specified by:
deliver in interface ScribeClient
Parameters:
topic - DESCRIBE THE PARAMETER
content - DESCRIBE THE PARAMETER

sendAnycast

public void sendAnycast()
Sends an anycast message.


anycast

public boolean anycast(Topic topic,
                       ScribeContent content)
Called when we receive an anycast. If we return false, it will be delivered elsewhere. Returning true stops the message here.

Specified by:
anycast in interface ScribeClient
Parameters:
topic - DESCRIBE THE PARAMETER
content - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

childAdded

public void childAdded(Topic topic,
                       NodeHandle child)
DESCRIBE THE METHOD

Specified by:
childAdded in interface ScribeClient
Parameters:
topic - DESCRIBE THE PARAMETER
child - DESCRIBE THE PARAMETER

childRemoved

public void childRemoved(Topic topic,
                         NodeHandle child)
DESCRIBE THE METHOD

Specified by:
childRemoved in interface ScribeClient
Parameters:
topic - DESCRIBE THE PARAMETER
child - DESCRIBE THE PARAMETER

subscribeFailed

public void subscribeFailed(Topic topic)
DESCRIBE THE METHOD

Specified by:
subscribeFailed in interface ScribeClient
Parameters:
topic - DESCRIBE THE PARAMETER

forward

public boolean forward(RouteMessage message)
DESCRIBE THE METHOD

Specified by:
forward in interface Application
Parameters:
message - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

update

public void update(NodeHandle handle,
                   boolean joined)
DESCRIBE THE METHOD

Specified by:
update in interface Application
Parameters:
handle - DESCRIBE THE PARAMETER
joined - DESCRIBE THE PARAMETER

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection