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.tutorial.forwarding
Class MyApp

    java.lang.Object
      rice.tutorial.forwarding.MyApp

All Implemented Interfaces:
  Application

    public class MyApp

extends java.lang.Object
implements Application

A very simple application.

Author:
  Jeff Hoye

Field Summary
`protected Endpoint` | `endpoint` The Endpoint represents the underlieing node.
`protected Node` | `node` The node we were constructed on.

Constructor Summary
`MyApp(Node node)`

Method Summary
`void` | `deliver(Id id, Message message)` Called when we receive a message.
`boolean` | `forward(RouteMessage message)` This method is invoked on applications when the underlying node is about to forward the given message with the provided target to the specified next hop.
`Node` | `getNode()` Getter for the node.
`void` | `routeMyMsg(Id id)` Called to route a message to the id
`void` | `routeMyMsgDirect(NodeHandle nh)` Called to directly send a message to the nh
`java.lang.String` | `toString()`
`void` | `update(NodeHandle handle, boolean joined)` Called when you hear about a new neighbor.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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.

### node

    protected Node node

  The node we were constructed on.

Constructor Detail

### MyApp

    public MyApp(Node node)

Method Detail

### getNode

    public Node getNode()

  Getter for the node.

### routeMyMsg

    public void routeMyMsg(Id id)

  Called to route a message to the id

### routeMyMsgDirect

    public void routeMyMsgDirect(NodeHandle nh)

  Called to directly send a message to the nh

### deliver

    public void deliver(Id id,
                        Message message)

  Called when we receive a message.

  Specified by:
    `deliver` in interface `Application`
  Parameters:
    `id` - The destination id of the message
    `message` - The message being sent

### update

    public void update(NodeHandle handle,
                       boolean joined)

  Called when you hear about a new neighbor. Don't worry about this method for now.

  Specified by:
    `update` in interface `Application`
  Parameters:
    `handle` - The handle that has joined/left
    `joined` - Whether the node has joined or left

### forward

    public boolean forward(RouteMessage message)

  Description copied from interface: `Application`
  This method is invoked on applications when the underlying node is about to forward the given message with the provided target to the specified next hop. Applications can change the contents of the message, specify a different nextHop (through re-routing), or completely terminate the message.

  Specified by:
    `forward` in interface `Application`
  Parameters:
    `message` - The message being sent, containing an internal message along with a destination key and nodeHandle next hop.
  Returns:
    true if it should continue along the path. false will deliver it locally

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

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.