Rice Pastry API

rice.p2p.scribe.messaging
Class AnycastMessage

java.lang.Object
  extended by rice.p2p.scribe.messaging.ScribeMessage
      extended by rice.p2p.scribe.messaging.AnycastMessage
All Implemented Interfaces:
java.io.Serializable, Message, RawMessage, RawSerializable
Direct Known Subclasses:
SubscribeMessage

public class AnycastMessage
extends ScribeMessage

Version:
$Id: AnycastMessage.java 4654 2009-01-08 16:33:07Z jeffh $
Author:
Alan Mislove
See Also:
Serialized Form

Field Summary
protected  RawScribeContent content
          the content of this message
protected  NodeHandle initialRequestor
           
protected  java.util.LinkedList<NodeHandle> toVisit
          the list of nodes which we are going to visit
static short TYPE
           
protected  java.util.ArrayList<NodeHandle> visited
          the list of nodes which we have visited
 
Fields inherited from class rice.p2p.scribe.messaging.ScribeMessage
source, topic
 
Fields inherited from interface rice.p2p.commonapi.Message
DEFAULT_PRIORITY, HIGH_PRIORITY, LOW_PRIORITY, LOWEST_PRIORITY, MAX_PRIORITY, MEDIUM_HIGH_PRIORITY, MEDIUM_LOW_PRIORITY, MEDIUM_PRIORITY
 
Constructor Summary
protected AnycastMessage(InputBuffer buf, Endpoint endpoint, ScribeContentDeserializer cd)
          Protected because it should only be called from an extending class, to get version numbers correct.
  AnycastMessage(NodeHandle source, Topic topic, RawScribeContent content)
           
  AnycastMessage(NodeHandle source, Topic topic, ScribeContent content)
          Constructor which takes a unique integer Id
 
Method Summary
 void addFirst(NodeHandle handle)
          Adds a node the the front of the to-visit list
 void addLast(NodeHandle handle)
          Adds a node the the end of the to-visit list
 void addVisited(NodeHandle handle)
          Adds a node to the visited list
static AnycastMessage build(InputBuffer buf, Endpoint endpoint, ScribeContentDeserializer scd)
           
 ScribeContent getContent()
          Returns the content
 NodeHandle getInitialRequestor()
           
 NodeHandle getLastVisited()
           
 NodeHandle getNext()
          Returns the next handle to visit and removes the node from the list.
 RawScribeContent getRawContent()
           
 int getToVisitSize()
           
 short getType()
          Raw Serialization **************************************
 int getVisitedSize()
           
 boolean hasVisited(NodeHandle handle)
           
 NodeHandle peekLastToVisit()
           
 NodeHandle peekNext()
          Returns the next handle to visit
 void remove(NodeHandle handle)
          Removes the node handle from the to visit and visited lists
 void serialize(OutputBuffer buf)
           
protected  void serializeHelper(OutputBuffer buf)
          Use this to allow SubscribeMessage to extend this, but not have the version number nor the content.
 void setContent(RawScribeContent content)
          Sets the content
 void setContent(ScribeContent content)
           
 java.lang.String toString()
           
 
Methods inherited from class rice.p2p.scribe.messaging.ScribeMessage
getPriority, getSource, getTopic, setSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

public static final short TYPE
See Also:
Constant Field Values

content

protected RawScribeContent content
the content of this message


visited

protected java.util.ArrayList<NodeHandle> visited
the list of nodes which we have visited


toVisit

protected java.util.LinkedList<NodeHandle> toVisit
the list of nodes which we are going to visit


initialRequestor

protected NodeHandle initialRequestor
Constructor Detail

AnycastMessage

public AnycastMessage(NodeHandle source,
                      Topic topic,
                      ScribeContent content)
Constructor which takes a unique integer Id

Parameters:
source - The source address
topic - The topic
content - The content

AnycastMessage

public AnycastMessage(NodeHandle source,
                      Topic topic,
                      RawScribeContent content)

AnycastMessage

protected AnycastMessage(InputBuffer buf,
                         Endpoint endpoint,
                         ScribeContentDeserializer cd)
                  throws java.io.IOException
Protected because it should only be called from an extending class, to get version numbers correct.

Throws:
java.io.IOException
Method Detail

getContent

public ScribeContent getContent()
Returns the content

Returns:
The content

getRawContent

public RawScribeContent getRawContent()

setContent

public void setContent(RawScribeContent content)
Sets the content

Parameters:
content - The content

setContent

public void setContent(ScribeContent content)

peekNext

public NodeHandle peekNext()
Returns the next handle to visit

Returns:
The next handle to visit

getNext

public NodeHandle getNext()
Returns the next handle to visit and removes the node from the list.

Returns:
The next handle to visit

peekLastToVisit

public NodeHandle peekLastToVisit()

addVisited

public void addVisited(NodeHandle handle)
Adds a node to the visited list

Parameters:
handle - The node to add

addFirst

public void addFirst(NodeHandle handle)
Adds a node the the front of the to-visit list

Parameters:
handle - The handle to add

addLast

public void addLast(NodeHandle handle)
Adds a node the the end of the to-visit list

Parameters:
handle - The handle to add

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getInitialRequestor

public NodeHandle getInitialRequestor()

getLastVisited

public NodeHandle getLastVisited()

remove

public void remove(NodeHandle handle)
Removes the node handle from the to visit and visited lists

Parameters:
handle - The handle to remove

getVisitedSize

public int getVisitedSize()

getToVisitSize

public int getToVisitSize()

hasVisited

public boolean hasVisited(NodeHandle handle)

getType

public short getType()
Raw Serialization **************************************


serialize

public void serialize(OutputBuffer buf)
               throws java.io.IOException
Specified by:
serialize in interface RawSerializable
Overrides:
serialize in class ScribeMessage
Throws:
java.io.IOException

serializeHelper

protected void serializeHelper(OutputBuffer buf)
                        throws java.io.IOException
Use this to allow SubscribeMessage to extend this, but not have the version number nor the content.

Throws:
java.io.IOException

build

public static AnycastMessage build(InputBuffer buf,
                                   Endpoint endpoint,
                                   ScribeContentDeserializer scd)
                            throws java.io.IOException
Throws:
java.io.IOException

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection