Rice Pastry API

rice.pastry.routing
Class RouteMessage

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

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 3613 2007-02-15 14:45:14Z jstewart $
Author:
Andrew Ladd
See Also:
Serialized Form

Field Summary
 NodeHandle nextHop
           
static short TYPE
           
 
Fields inherited from class rice.pastry.messaging.Message
DEFAULT_PRIORITY_LEVEL
 
Fields inherited from interface rice.p2p.commonapi.Message
HIGH_PRIORITY, LOW_PRIORITY, LOWEST_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)
           
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)
           
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()
           
 int getDestination()
          Get receiver address.
 Id getDestinationId()
          Returns the destination Id for this message
 short getInternalType()
           
 Message getMessage()
          Deprecated. use getMessage(MessageDeserializer)
 Message getMessage(MessageDeserializer md)
           
 NodeHandle getNextHop()
           
 NodeHandle getNextHopHandle()
          Returns the next hop handle for this message
 SendOptions getOptions()
          Get transmission options.
 NodeHandle getPrevNode()
           
 int getPriority()
          Get priority
 Id getTarget()
          Gets the target node id of this message.
 short getType()
           
 boolean routeMessage(NodeHandle localHandle)
          Routes the messages if the next hop has been set up.
 void serialize(OutputBuffer buf)
           
 void setDestinationId(Id id)
          Sets the destination Id for this message
 void setMessage(Message message)
          Sets the internal message for this message
 void setMessage(RawMessage message)
          Sets the internal message for this message Does the same as setMessage(Message) but with better performance, because it doesn't have to introspect if the message is a RawMessage
 void setNextHop(NodeHandle nh)
           
 void setNextHopHandle(NodeHandle nextHop)
          Sets the next hop handle for this message
 void setPrevNode(NodeHandle n)
           
 java.lang.String toString()
           
 Message unwrap()
          Deprecated. use unwrap(MessageDeserializer)
 Message unwrap(MessageDeserializer md)
           
 
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

TYPE

public static final short TYPE
See Also:
Constant Field Values

nextHop

public transient NodeHandle nextHop
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.
cred - the credentials for the 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.
cred - the credentials for the 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.
cred - the credentials for the message.
opts - the send options for the message.
aux - an auxilary address which the message after each hop.

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
aux - an auxilary address which the message after each hop.

RouteMessage

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

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.
aux - an auxilary address which the message after each hop.

RouteMessage

public RouteMessage(Id target,
                    int auxAddress,
                    NodeHandle prev,
                    InputBuffer buf,
                    NodeHandleFactory nhf,
                    PastryNode pn)
             throws java.io.IOException
Throws:
java.io.IOException
Method Detail

routeMessage

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

Parameters:
localId - the node id of the local node.
Returns:
true if the message got routed, false otherwise.

getTarget

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

Returns:
the target node id.

getPrevNode

public NodeHandle getPrevNode()

setPrevNode

public void setPrevNode(NodeHandle n)

getNextHop

public NodeHandle getNextHop()

setNextHop

public void setNextHop(NodeHandle nh)

getPriority

public int 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.

unwrap

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

The wrapped message.

Returns:
the wrapped message.

getOptions

public SendOptions getOptions()
Get transmission options.

Returns:
the options.

toString

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

getDestinationId

public Id getDestinationId()
Description copied from interface: RouteMessage
Returns the destination Id for this message

Specified by:
getDestinationId in interface RouteMessage
Returns:
The destination Id

getNextHopHandle

public NodeHandle getNextHopHandle()
Description copied from interface: RouteMessage
Returns the next hop handle for this message

Specified by:
getNextHopHandle in interface RouteMessage
Returns:
The next hop

getMessage

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

Description copied from interface: RouteMessage
Returns the enclosed message inside of this message

Specified by:
getMessage in interface RouteMessage
Returns:
The enclosed message

getMessage

public Message getMessage(MessageDeserializer md)
                   throws java.io.IOException
Specified by:
getMessage in interface RouteMessage
Throws:
java.io.IOException

setDestinationId

public void setDestinationId(Id id)
Description copied from interface: RouteMessage
Sets the destination Id for this message

Specified by:
setDestinationId in interface RouteMessage
Parameters:
id - The destination Id

setNextHopHandle

public void setNextHopHandle(NodeHandle nextHop)
Description copied from interface: RouteMessage
Sets the next hop handle for this message

Specified by:
setNextHopHandle in interface RouteMessage
Parameters:
nextHop - The next hop for this handle

setMessage

public void setMessage(Message message)
Description copied from interface: RouteMessage
Sets the internal message for this message

Specified by:
setMessage in interface RouteMessage
Parameters:
message - The internal message

setMessage

public void setMessage(RawMessage message)
Description copied from interface: RouteMessage
Sets the internal message for this message Does the same as setMessage(Message) but with better performance, because it doesn't have to introspect if the message is a RawMessage

Specified by:
setMessage in interface RouteMessage
Parameters:
message - The internal message

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 -
Returns:
Throws:
java.io.IOException

serialize

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

unwrap

public Message unwrap(MessageDeserializer md)
               throws java.io.IOException
Throws:
java.io.IOException

getType

public short getType()
Specified by:
getType in interface RawMessage

getAuxAddress

public int getAuxAddress()

getInternalType

public short getInternalType()

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection