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.p2p.multiring
Class MultiringNode

    java.lang.Object
      rice.p2p.multiring.MultiringNode

All Implemented Interfaces:
  Node, ScribeClient

    public class MultiringNode

extends java.lang.Object
implements Node, ScribeClient

Version:
  $Id: MultiringNode.java 3992 2007-12-02 20:09:18Z jeffh $
Author:
  Alan Mislove

Field Summary
`protected MultiringNodeCollection` | `collection` The collection, which keeps track of the other nodes on the ring node
`protected java.util.Hashtable` | `endpoints` The list of all of the endpoints connected to this node
`protected Environment` | `environment` The environment
`protected MultiringIdFactory` | `factory` A cached IdFactory for internal use
`protected Logger` | `logger`
`protected Node` | `node` The node which this multiring node is wrapping
`protected Id` | `ringId` The Id which represents the current ring this node is a member of
`protected Scribe` | `scribe` The Scribe application which the node uses to do routing

Constructor Summary
`MultiringNode(Id ringId, Node node)` Constructor
`MultiringNode(Id ringId, Node node, MultiringNode existing)` Constructor

Method Summary
`boolean` | `anycast(Topic topic, ScribeContent content)` This method is invoked when an anycast is received for a topic which this client is interested in.
`Endpoint` | `buildEndpoint(Application application, java.lang.String instance)` Same as register application, but returns an unregistered Endpoint.
`void` | `childAdded(Topic topic, NodeHandle child)` Informs this client that a child was added to a topic in which it was interested in.
`void` | `childRemoved(Topic topic, NodeHandle child)` Informs this client that a child was removed from a topic in which it was interested in.
`void` | `deliver(Topic topic, ScribeContent content)` This method is invoked when a message is delivered for a topic this client is interested in.
`MultiringNodeCollection` | `getCollection()` Returns the collection this node is a member of
`Environment` | `getEnvironment()` Getter for the environment.
`Id` | `getId()` Returns the Id of this node
`IdFactory` | `getIdFactory()` Returns a factory for Ids specific to this node's protocol.
`NodeHandle` | `getLocalNodeHandle()` Returns a handle to the local node.
`Node` | `getNode()` Returns this mutliring node's internal node
`Id` | `getNodeId()` Returns the underlying id of this node
`Id` | `getRingId()` Returns the ringId of this node
`protected void` | `nodeAdded(Id otherRingId)` Method which is used to inform the node that another node has been added to the collection.
`java.lang.String` | `printRouteState()` For debugging: print the internal routing state of the Node.
`Endpoint` | `registerApplication(Application application, java.lang.String instance)` Deprecated. use buildEndpoint() endpoint.register()
`void` | `subscribeFailed(Topic topic)` Informs the client that a subscribe on the given topic failed - the client should retry the subscribe or take appropriate action.
`java.lang.String` | `toString()` Prints out the string

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

Field Detail

### node

    protected Node node

  The node which this multiring node is wrapping

### ringId

    protected Id ringId

  The Id which represents the current ring this node is a member of

### scribe

    protected Scribe scribe

  The Scribe application which the node uses to do routing

### collection

    protected MultiringNodeCollection collection

  The collection, which keeps track of the other nodes on the ring node

### endpoints

    protected java.util.Hashtable endpoints

  The list of all of the endpoints connected to this node

### factory

    protected MultiringIdFactory factory

  A cached IdFactory for internal use

### environment

    protected Environment environment

  The environment

### logger

    protected Logger logger

Constructor Detail

### MultiringNode

    public MultiringNode(Id ringId,
                         Node node)

  Constructor

  Parameters:
    `node` - The node which this multiring node is wrapping
    `ringId` - The Id of this node's ring

### MultiringNode

    public MultiringNode(Id ringId,
                         Node node,
                         MultiringNode existing)

  Constructor

  Parameters:
    `node` - The node which this multiring node is wrapping
    `ringId` - The Id of this node's ring
    `existing` - An existing node which this node should pair with

Method Detail

### getLocalNodeHandle

    public NodeHandle getLocalNodeHandle()

  Description copied from interface: `Node`
  Returns a handle to the local node. This node handle is serializable, and can therefore be sent to other nodes in the network and still be valid.

  Specified by:
    `getLocalNodeHandle` in interface `Node`
  Returns:
    A NodeHandle referring to the local node.

### registerApplication

    public Endpoint registerApplication(Application application,
                                        java.lang.String instance)

  Deprecated. use buildEndpoint() endpoint.register()

  This returns a VirtualizedNode specific to the given application and instance name to the application, which the application can then use in order to send an receive messages.

  Specified by:
    `registerApplication` in interface `Node`
  Parameters:
    `application` - The Application
    `instance` - An identifier for a given instance
  Returns:
    The endpoint specific to this applicationk, which can be used for message sending/receiving.

### buildEndpoint

    public Endpoint buildEndpoint(Application application,
                                  java.lang.String instance)

  Description copied from interface: `Node`
  Same as register application, but returns an unregistered Endpoint. This allows the application to finish initialization that may require the endpoint before it receives messages from the network and notification of changes. When then application is ready, it must call endpoint.register() to receive messages.

  Specified by:
    `buildEndpoint` in interface `Node`
  Returns:

### getId

    public Id getId()

  Returns the Id of this node

  Specified by:
    `getId` in interface `Node`
  Returns:
    This node's Id

### getRingId

    public Id getRingId()

  Returns the ringId of this node

  Returns:
    This node's ringId

### getNodeId

    public Id getNodeId()

  Returns the underlying id of this node

  Returns:
    This node's Id

### getNode

    public Node getNode()

  Returns this mutliring node's internal node

  Returns:
    The wrapped node

### getCollection

    public MultiringNodeCollection getCollection()

  Returns the collection this node is a member of

  Returns:
    This node's collection

### getIdFactory

    public IdFactory getIdFactory()

  Returns a factory for Ids specific to this node's protocol.

  Specified by:
    `getIdFactory` in interface `Node`
  Returns:
    A factory for creating Ids.

### nodeAdded

    protected void nodeAdded(Id otherRingId)

  Method which is used to inform the node that another node has been added to the collection. This node then joins the appropriate Scribe group to advertise this it can route directly to that node's ring.

  Parameters:
    `id` - The Id of the newly added ring

### anycast

    public boolean anycast(Topic topic,
                           ScribeContent content)

  This method is invoked when an anycast is received for a topic which this client is interested in. The client should return whether or not the anycast should continue.

  Specified by:
    `anycast` in interface `ScribeClient`
  Parameters:
    `topic` - The topic the message was anycasted to
    `content` - The content which was anycasted
  Returns:
    Whether or not the anycast should continue

### deliver

    public void deliver(Topic topic,
                        ScribeContent content)

  This method is invoked when a message is delivered for a topic this client is interested in.

  Specified by:
    `deliver` in interface `ScribeClient`
  Parameters:
    `topic` - The topic the message was published to
    `content` - The content which was published

### childAdded

    public void childAdded(Topic topic,
                           NodeHandle child)

  Informs this client that a child was added to a topic in which it was interested in.

  Specified by:
    `childAdded` in interface `ScribeClient`
  Parameters:
    `topic` - The topic to unsubscribe from
    `child` - The child that was added

### childRemoved

    public void childRemoved(Topic topic,
                             NodeHandle child)

  Informs this client that a child was removed from a topic in which it was interested in.

  Specified by:
    `childRemoved` in interface `ScribeClient`
  Parameters:
    `topic` - The topic to unsubscribe from
    `child` - The child that was removed

### subscribeFailed

    public void subscribeFailed(Topic topic)

  Informs the client that a subscribe on the given topic failed - the client should retry the subscribe or take appropriate action.

  Specified by:
    `subscribeFailed` in interface `ScribeClient`
  Parameters:
    `topic` - The topic which the subscribe failed on

### toString

    public java.lang.String toString()

  Prints out the string

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    A string

### getEnvironment

    public Environment getEnvironment()

  Getter for the environment.

  Specified by:
    `getEnvironment` in interface `Node`
  Returns:
    the environment

### printRouteState

    public java.lang.String printRouteState()

  Description copied from interface: `Node`
  For debugging: print the internal routing state of the Node.

  Specified by:
    `printRouteState` in interface `Node`
  Returns:

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.