Rice Pastry API

rice.pastry.routing
Class RouteMessage

java.lang.Object
  extended byrice.pastry.messaging.Message
      extended byrice.pastry.messaging.PRawMessage
          extended byrice.pastry.routing.RouteMessage
All Implemented Interfaces:
Message, RawMessage, RouteMessage, java.io.Serializable

public class RouteMessage
extends PRawMessage
implements java.io.Serializable, RouteMessage

A route message contains a pastry message that has been wrapped to be sent to another pastry node.

Version:
$Id: RouteMessage.java 3274 2006-05-15 16:17:47Z jeffh $
Author:
Andrew Ladd
See Also:
Serialized Form

Field Summary
 NodeHandle nextHop
          DESCRIBE THE FIELD
static short TYPE
          DESCRIBE THE FIELD
 
Fields inherited from class rice.pastry.messaging.Message
DEFAULT_PRIORITY_LEVEL
 
Fields inherited from interface rice.p2p.commonapi.Message
HIGH_PRIORITY, LOW_PRIORITY, MAX_PRIORITY, MEDIUM_HIGH_PRIORITY, MEDIUM_LOW_PRIORITY, MEDIUM_PRIORITY
 
Constructor Summary
RouteMessage(Id target, int auxAddress, NodeHandle prev, InputBuffer buf, NodeHandleFactory nhf, PastryNode pn)
          Constructor for RouteMessage.
RouteMessage(Id target, Message msg)
          Constructor.
RouteMessage(Id target, Message msg, NodeHandle firstHop)
          Constructor.
RouteMessage(Id target, Message msg, NodeHandle firstHop, SendOptions opts)
          Constructor.
RouteMessage(Id target, Message msg, SendOptions opts)
          Constructor.
RouteMessage(Id target, PRawMessage msg, NodeHandle firstHop, SendOptions opts)
          Constructor for RouteMessage.
RouteMessage(NodeHandle dest, Message msg, SendOptions opts)
          Constructor.
 
Method Summary
static RouteMessage build(InputBuffer buf, NodeHandleFactory nhf, PastryNode pn)
          +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + int auxAddress + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + Id target + + + + + + + + + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + NodeHandle prev + + (used to repair routing table during routing) + + + ...
 int getAuxAddress()
          Gets the AuxAddress attribute of the RouteMessage object
 int getDestination()
          Get receiver address.
 Id getDestinationId()
          Gets the DestinationId attribute of the RouteMessage object
 short getInternalType()
          Gets the InternalType attribute of the RouteMessage object
 Message getMessage()
          Gets the Message attribute of the RouteMessage object
 Message getMessage(MessageDeserializer md)
          Gets the Message attribute of the RouteMessage object
 NodeHandle getNextHop()
          Gets the NextHop attribute of the RouteMessage object
 NodeHandle getNextHopHandle()
          Gets the NextHopHandle attribute of the RouteMessage object
 SendOptions getOptions()
          Get transmission options.
 NodeHandle getPrevNode()
          Gets the PrevNode attribute of the RouteMessage object
 byte getPriority()
          Get priority
 Id getTarget()
          Gets the target node id of this message.
 short getType()
          Gets the Type attribute of the RouteMessage object
 boolean routeMessage(NodeHandle localHandle)
          Routes the messages if the next hop has been set up.
 void serialize(OutputBuffer buf)
          DESCRIBE THE METHOD
 void setDestinationId(Id id)
          Sets the DestinationId attribute of the RouteMessage object
 void setMessage(Message message)
          Sets the Message attribute of the RouteMessage object
 void setMessage(RawMessage message)
          Sets the Message attribute of the RouteMessage object
 void setNextHop(NodeHandle nh)
          Sets the NextHop attribute of the RouteMessage object
 void setNextHopHandle(NodeHandle nextHop)
          Sets the NextHopHandle attribute of the RouteMessage object
 void setPrevNode(NodeHandle n)
          Sets the PrevNode attribute of the RouteMessage object
 java.lang.String toString()
          DESCRIBE THE METHOD
 Message unwrap()
          Deprecated. use unwrap(MessageDeserializer)
 Message unwrap(MessageDeserializer md)
          DESCRIBE THE METHOD
 
Methods inherited from class rice.pastry.messaging.Message
getDate, getSender, getSenderId, setPriority, setSender, stamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nextHop

public transient NodeHandle nextHop
DESCRIBE THE FIELD


TYPE

public static final short TYPE
DESCRIBE THE FIELD

See Also:
Constant Field Values
Constructor Detail

RouteMessage

public RouteMessage(Id target,
                    Message msg)
Constructor.

Parameters:
target - this is id of the node the message will be routed to.
msg - the wrapped message.

RouteMessage

public RouteMessage(Id target,
                    Message msg,
                    SendOptions opts)
Constructor.

Parameters:
target - this is id of the node the message will be routed to.
msg - the wrapped message.
opts - the send options for the message.

RouteMessage

public RouteMessage(NodeHandle dest,
                    Message msg,
                    SendOptions opts)
Constructor.

Parameters:
dest - the node this message will be routed to
msg - the wrapped message.
opts - the send options for the message.

RouteMessage

public RouteMessage(Id target,
                    Message msg,
                    NodeHandle firstHop)
Constructor.

Parameters:
target - this is id of the node the message will be routed to.
msg - the wrapped message.
firstHop - the nodeHandle of the first hop destination

RouteMessage

public RouteMessage(Id target,
                    PRawMessage msg,
                    NodeHandle firstHop,
                    SendOptions opts)
Constructor for RouteMessage.

Parameters:
target - DESCRIBE THE PARAMETER
msg - DESCRIBE THE PARAMETER
firstHop - DESCRIBE THE PARAMETER
opts - DESCRIBE THE PARAMETER

RouteMessage

public RouteMessage(Id target,
                    Message msg,
                    NodeHandle firstHop,
                    SendOptions opts)
Constructor.

Parameters:
target - this is id of the node the message will be routed to.
msg - the wrapped message.
firstHop - the nodeHandle of the first hop destination
opts - the send options for the message.

RouteMessage

public RouteMessage(Id target,
                    int auxAddress,
                    NodeHandle prev,
                    InputBuffer buf,
                    NodeHandleFactory nhf,
                    PastryNode pn)
Constructor for RouteMessage.

Parameters:
target - DESCRIBE THE PARAMETER
auxAddress - DESCRIBE THE PARAMETER
prev - DESCRIBE THE PARAMETER
buf - DESCRIBE THE PARAMETER
nhf - DESCRIBE THE PARAMETER
pn - DESCRIBE THE PARAMETER
Method Detail

getTarget

public Id getTarget()
Gets the target node id of this message.

Returns:
the target node id.

getPrevNode

public NodeHandle getPrevNode()
Gets the PrevNode attribute of the RouteMessage object

Returns:
The PrevNode value

getNextHop

public NodeHandle getNextHop()
Gets the NextHop attribute of the RouteMessage object

Returns:
The NextHop value

getPriority

public byte getPriority()
Get priority

Specified by:
getPriority in interface Message
Overrides:
getPriority in class Message
Returns:
the priority of this message.

getDestination

public int getDestination()
Get receiver address.

Overrides:
getDestination in class Message
Returns:
the address.

getOptions

public SendOptions getOptions()
Get transmission options.

Returns:
the options.

getDestinationId

public Id getDestinationId()
Gets the DestinationId attribute of the RouteMessage object

Specified by:
getDestinationId in interface RouteMessage
Returns:
The DestinationId value

getNextHopHandle

public NodeHandle getNextHopHandle()
Gets the NextHopHandle attribute of the RouteMessage object

Specified by:
getNextHopHandle in interface RouteMessage
Returns:
The NextHopHandle value

getMessage

public Message getMessage()
Gets the Message attribute of the RouteMessage object

Specified by:
getMessage in interface RouteMessage
Returns:
The Message value

getMessage

public Message getMessage(MessageDeserializer md)
                   throws java.io.IOException
Gets the Message attribute of the RouteMessage object

Specified by:
getMessage in interface RouteMessage
Parameters:
md - DESCRIBE THE PARAMETER
Returns:
The Message value
Throws:
java.io.IOException - DESCRIBE THE EXCEPTION

getType

public short getType()
Gets the Type attribute of the RouteMessage object

Specified by:
getType in interface RawMessage
Returns:
The Type value

getAuxAddress

public int getAuxAddress()
Gets the AuxAddress attribute of the RouteMessage object

Returns:
The AuxAddress value

getInternalType

public short getInternalType()
Gets the InternalType attribute of the RouteMessage object

Returns:
The InternalType value

setPrevNode

public void setPrevNode(NodeHandle n)
Sets the PrevNode attribute of the RouteMessage object

Parameters:
n - The new PrevNode value

setNextHop

public void setNextHop(NodeHandle nh)
Sets the NextHop attribute of the RouteMessage object

Parameters:
nh - The new NextHop value

setDestinationId

public void setDestinationId(Id id)
Sets the DestinationId attribute of the RouteMessage object

Specified by:
setDestinationId in interface RouteMessage
Parameters:
id - The new DestinationId value

setNextHopHandle

public void setNextHopHandle(NodeHandle nextHop)
Sets the NextHopHandle attribute of the RouteMessage object

Specified by:
setNextHopHandle in interface RouteMessage
Parameters:
nextHop - The new NextHopHandle value

setMessage

public void setMessage(Message message)
Sets the Message attribute of the RouteMessage object

Specified by:
setMessage in interface RouteMessage
Parameters:
message - The new Message value

setMessage

public void setMessage(RawMessage message)
Sets the Message attribute of the RouteMessage object

Specified by:
setMessage in interface RouteMessage
Parameters:
message - The new Message value

routeMessage

public boolean routeMessage(NodeHandle localHandle)
Routes the messages if the next hop has been set up.

Parameters:
localHandle - DESCRIBE THE PARAMETER
Returns:
true if the message got routed, false otherwise.

unwrap

public Message unwrap()
Deprecated. use unwrap(MessageDeserializer)

The wrapped message.

Returns:
the wrapped message.

toString

public java.lang.String toString()
DESCRIBE THE METHOD

Returns:
DESCRIBE THE RETURN VALUE

serialize

public void serialize(OutputBuffer buf)
               throws java.io.IOException
DESCRIBE THE METHOD

Specified by:
serialize in interface RawMessage
Parameters:
buf - DESCRIBE THE PARAMETER
Throws:
java.io.IOException - DESCRIBE THE EXCEPTION

unwrap

public Message unwrap(MessageDeserializer md)
               throws java.io.IOException
DESCRIBE THE METHOD

Parameters:
md - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE
Throws:
java.io.IOException - DESCRIBE THE EXCEPTION

build

public static RouteMessage build(InputBuffer buf,
                                 NodeHandleFactory nhf,
                                 PastryNode pn)
                          throws java.io.IOException
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + int auxAddress + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + Id target + + + + + + + + + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + NodeHandle prev + + (used to repair routing table during routing) + + + ... + + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + Internal Message + + (see below) + + +

Parameters:
buf -
nhf - DESCRIBE THE PARAMETER
pn - DESCRIBE THE PARAMETER
Returns:
Throws:
java.io.IOException - DESCRIBE THE EXCEPTION

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection