rice.scribe.messaging
Class ScribeMessage

java.lang.Object
  extended byrice.pastry.messaging.Message
      extended byrice.scribe.messaging.ScribeMessage
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
MessageAckOnSubscribe, MessageAnycast, MessageCreate, MessageHeartBeat, MessagePublish, MessageReplyFromParent, MessageRequestToParent, MessageScribeMaintenance, MessageSubscribe, MessageUnsubscribe

public abstract class ScribeMessage
extends Message
implements java.io.Serializable

This is an abstract implementation of a Scribe message object.

See Also:
Serialized Form

Field Summary
protected  NodeHandle m_source
          The ID of the source of this message.
protected  NodeId m_topicId
          The ID of the topic that this message refers to.
 
Constructor Summary
ScribeMessage(Address addr, NodeHandle source, NodeId tid, Credentials c)
          Constructor
 
Method Summary
 java.io.Serializable getData()
          Gets the data inside of the ScribeMessage object.
 NodeHandle getSource()
          Returns the nodeId of the node that generated the message.
 NodeId getTopicId()
          Returns the topicId associated with the message.
abstract  void handleDeliverMessage(Scribe scribe, Topic topic)
          This method is called whenever the scribe node receives a message for itself and wants to process it.
abstract  boolean handleForwardMessage(Scribe scribe, Topic topic)
          This method is called whenever the scribe node forwards a message in the scribe network.
 void setData(java.io.Serializable data)
          Sets the data contained in the message.
abstract  java.lang.String toString()
           
 
Methods inherited from class rice.pastry.messaging.Message
getCredentials, getDate, getDestination, getSenderId, getStream, hasPriority, setPriority, setSenderId, stamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_topicId

protected NodeId m_topicId
The ID of the topic that this message refers to. Should be serializable.


m_source

protected NodeHandle m_source
The ID of the source of this message. Should be serializable.

Constructor Detail

ScribeMessage

public ScribeMessage(Address addr,
                     NodeHandle source,
                     NodeId tid,
                     Credentials c)
Constructor

Parameters:
addr - the address of the scribe receiver.
source - the node generating the message.
c - the credentials associated with the mesasge.
Method Detail

handleDeliverMessage

public abstract void handleDeliverMessage(Scribe scribe,
                                          Topic topic)
This method is called whenever the scribe node receives a message for itself and wants to process it. The processing is delegated by scribe to the message.

Parameters:
scribe - the scribe application
topic - the topic within the scribe application

handleForwardMessage

public abstract boolean handleForwardMessage(Scribe scribe,
                                             Topic topic)
This method is called whenever the scribe node forwards a message in the scribe network. The processing is delegated by scribe to the message.

Parameters:
scribe - the scribe application.
topic - the topic within the scribe application.
Returns:
true if the message should be routed further, false otherwise.

setData

public void setData(java.io.Serializable data)
Sets the data contained in the message.

Parameters:
data - the data contained in the message.

getData

public java.io.Serializable getData()
Gets the data inside of the ScribeMessage object.

Returns:
the data contained in the message.

getTopicId

public NodeId getTopicId()
Returns the topicId associated with the message.

Returns:
topicId to which the message was posted.

getSource

public NodeHandle getSource()
Returns the nodeId of the node that generated the message.

Returns:
the handle to the source node.

toString

public abstract java.lang.String toString()





Imprint-Dataprotection