Rice Pastry API

rice.p2p.scribe.messaging
Class SubscribeMessage

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

public class SubscribeMessage
extends AnycastMessage

Version:
$Id: SubscribeMessage.java 3801 2007-07-18 15:04:40Z jeffh $
Author:
Alan Mislove
See Also:
Serialized Form

Field Summary
protected  int id
          The id of this message
protected  NodeHandle subscriber
          The original subscriber
static short TYPE
           
 
Fields inherited from class rice.p2p.scribe.messaging.AnycastMessage
content, initialRequestor, toVisit, 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
SubscribeMessage(NodeHandle source, java.util.List<Topic> topics, int id, RawScribeContent content)
          Constructor which takes a unique integer Id
SubscribeMessage(NodeHandle source, Topic topic, int id, RawScribeContent content)
           
 
Method Summary
static SubscribeMessage buildSM(InputBuffer buf, Endpoint endpoint, ScribeContentDeserializer scd)
           
 SubscribeMessage copy(java.util.List<Topic> newTopics, RawScribeContent content)
          Copies everything except changes the topics to the new list
 int getId()
          Returns this subscribe lost message's id
 NodeHandle getSubscriber()
          Returns the node who is trying to subscribe
 java.util.List<Topic> getTopics()
           
 short getType()
          Raw Serialization
 boolean isEmpty()
           
 void removeTopics(java.util.Collection<Topic> accepted)
          Call this when you accept topics in the list.
 void serialize(OutputBuffer buf)
           
 java.lang.String toString()
          Returns a String represneting this message
 
Methods inherited from class rice.p2p.scribe.messaging.AnycastMessage
addFirst, addLast, addVisited, build, getContent, getInitialRequestor, getLastVisited, getNext, getRawContent, getToVisitSize, getVisitedSize, peekNext, remove, serializeHelper, setContent, setContent
 
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

subscriber

protected NodeHandle subscriber
The original subscriber


id

protected int id
The id of this message

Constructor Detail

SubscribeMessage

public SubscribeMessage(NodeHandle source,
                        java.util.List<Topic> topics,
                        int id,
                        RawScribeContent content)
Constructor which takes a unique integer Id

Parameters:
source - The source address
topics - The topics must be sorted, this is not verified. It will be routed to the first topic in the list.
id - The UID for this message
content - The content

SubscribeMessage

public SubscribeMessage(NodeHandle source,
                        Topic topic,
                        int id,
                        RawScribeContent content)
Parameters:
source -
topic - to subscribe to only 1 topic
id -
content -
Method Detail

getSubscriber

public NodeHandle getSubscriber()
Returns the node who is trying to subscribe

Returns:
The node who is attempting to subscribe

getId

public int getId()
Returns this subscribe lost message's id

Returns:
The id of this subscribe message

toString

public java.lang.String toString()
Returns a String represneting this message

Overrides:
toString in class AnycastMessage
Returns:
A String of this message

getType

public short getType()
Raw Serialization

Specified by:
getType in interface RawMessage
Overrides:
getType in class AnycastMessage

serialize

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

buildSM

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

removeTopics

public void removeTopics(java.util.Collection<Topic> accepted)
Call this when you accept topics in the list.

Parameters:
topic -

getTopics

public java.util.List<Topic> getTopics()

isEmpty

public boolean isEmpty()

copy

public SubscribeMessage copy(java.util.List<Topic> newTopics,
                             RawScribeContent content)
Copies everything except changes the topics to the new list

Parameters:
newTopics -
Returns:

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection