Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rice.pastry.testing
Class HelloWorldApp

    java.lang.Object
      rice.pastry.client.PastryAppl
          rice.pastry.testing.HelloWorldApp

All Implemented Interfaces:
  MessageReceiver

public class HelloWorldApp
extends PastryAppl

A hello world example for pastry. This is the per-node app object.

Version:
  $Id: HelloWorldApp.java 2808 2005-11-22 14:38:49Z jeffh $
Author:
  Sitaram Iyer

Field Summary

Fields inherited from class rice.pastry.client.PastryAppl
`address, instance, logger, thePastryNode`

Constructor Summary
`HelloWorldApp(PastryNode pn)` Constructor for HelloWorldApp.

Method Summary
`boolean` | `enrouteMessage(Message msg, Id key, NodeHandle nextHop, SendOptions opt)` Invoked on intermediate nodes in routing path.
`Address` | `getAddress()` Get address.
`Credentials` | `getCredentials()` Get credentials.
`void` | `leafSetChange(NodeHandle nh, boolean wasAdded)` Invoked upon change to leafset.
`void` | `messageForAppl(Message msg)` Invoked on destination node when a message arrives.
`void` | `notifyReady()` Invoked by {RMI,Direct}PastryNode when the node has something in its leaf set, and has become ready to receive application messages.
`void` | `routeSetChange(NodeHandle nh, boolean wasAdded)` Invoked upon change to routing table.
`void` | `sendRndMsg(RandomSource rng)` Sends a message to a randomly chosen node.

Methods inherited from class rice.pastry.client.PastryAppl
`deliverWhenNotReady, destroy, getLeafSet, getNodeHandle, getNodeId, getRoutingTable, isClosest, receiveMessage, registerReceiver, routeMsg, routeMsgDirect, sendMessage`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HelloWorldApp

    public HelloWorldApp(PastryNode pn)

  Constructor for HelloWorldApp.

Parameters:
  `pn` - DESCRIBE THE PARAMETER

Method Detail

### getAddress

    public Address getAddress()

  Get address.

  Overrides:
    `getAddress` in class `PastryAppl`
  Returns:
    the address of this application.

### getCredentials

    public Credentials getCredentials()

  Get credentials.

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

### sendRndMsg

    public void sendRndMsg(RandomSource rng)

  Sends a message to a randomly chosen node. Yeah, for fun.

  Parameters:
    `rng` - Randon number generator.

### messageForAppl

    public void messageForAppl(Message msg)

  Invoked on destination node when a message arrives.

  Specified by:
    `messageForAppl` in class `PastryAppl`
  Parameters:
    `msg` - Message being routed around

### enrouteMessage

    public boolean enrouteMessage(Message msg,
                                  Id key,
                                  NodeHandle nextHop,
                                  SendOptions opt)

  Invoked on intermediate nodes in routing path.

  Overrides:
    `enrouteMessage` in class `PastryAppl`
  Parameters:
    `msg` - Message that's passing through this node.
    `key` - destination
    `nextHop` - next hop
    `opt` - send options
  Returns:
    true if message needs to be forwarded according to plan.

### leafSetChange

    public void leafSetChange(NodeHandle nh,
                              boolean wasAdded)

  Invoked upon change to leafset.

  Overrides:
    `leafSetChange` in class `PastryAppl`
  Parameters:
    `nh` - node handle that got added/removed
    `wasAdded` - added (true) or removed (false)

### routeSetChange

    public void routeSetChange(NodeHandle nh,
                               boolean wasAdded)

  Invoked upon change to routing table.

  Overrides:
    `routeSetChange` in class `PastryAppl`
  Parameters:
    `nh` - node handle that got added/removed
    `wasAdded` - added (true) or removed (false)

### notifyReady

    public void notifyReady()

  Invoked by {RMI,Direct}PastryNode when the node has something in its leaf set, and has become ready to receive application messages.

  Overrides:
    `notifyReady` in class `PastryAppl`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005 - Rice Pastry.