planet.commonapi
Interface RouteMessage

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
RouteMessageImpl

public interface RouteMessage
extends java.io.Serializable

This interface is a container which represents a message, as it is about to be forwarded to another node.

Author:
Jordi Pujol, Marc Sánchez

Method Summary
 void decTimeToLive()
          Decreases the Time to Live for the packet.
 java.lang.String getApplicationId()
          Returns the application Id for this message
 NodeHandle getDestination()
          Returns the destination NodeHandle for this message
 java.lang.String getKey()
          Gets the identification key of this communication.
 Message getMessage()
          Returns the enclosed message inside of this message
 int getMode()
          Gets the mode of the actual Message.
 NodeHandle getNextHopHandle()
          Returns the next hop handle for this message.
 java.lang.Object getOptions()
           
 NodeHandle getPreviousHopHandle()
          Gets the previous hop handle for this message.
 java.util.Collection getRoute()
          Returns the route from the source to the destination.
 NodeHandle getSource()
          Returns the source NodeHandle for this message
 int getTimeToLive()
          Gets the time to live for the packet.
 int getType()
          Gets the type of the actual Message.
 boolean routeMessagesHasExpired()
          Returns true if RouteMessage has expired.
 void setApplicationId(java.lang.String app)
          Sets the application name
 void setDestination(NodeHandle handle)
          Sets the destination NodeHandle for this message
 void setKey(java.lang.String key)
          Sets the identification key of this communication.
 void setMessage(Message message)
          Sets the internal message for this message
 void setMode(int mode)
          Sets the mode of the actual Message.
 void setNewNodeAlongRoute(NodeHandle node)
          Adds a new node along the current path.
 void setNextHopHandle(NodeHandle nextHop)
          Sets the next hop handle for this message
 void setOptions(java.lang.Object o)
          Set RouteMessage additional options.
 void setPreviousHopHandle(NodeHandle previousHop)
          Sets the previous hop handle for this message.
 void setRoute(java.util.Collection route)
          Sets the route for the new path from the source to the destination
 void setSource(NodeHandle handle)
          Sets the source NodeHandle for this message
 void setTimeToLive(int ttl)
          Sets Time to Live For The Message.
 void setType(int type)
          Sets the type of the actual Message.
 void setValues(java.lang.String appId, NodeHandle to, NodeHandle from, NodeHandle nh, Message msg, java.lang.String key, int type, int mode)
          Sets all values of the actual RouteMessage, before to be sent.
 

Method Detail

getApplicationId

java.lang.String getApplicationId()
Returns the application Id for this message

Returns:
The application Id

getDestination

NodeHandle getDestination()
Returns the destination NodeHandle for this message

Returns:
The destination NodeHandle

getSource

NodeHandle getSource()
Returns the source NodeHandle for this message

Returns:
The source NodeHandle

getNextHopHandle

NodeHandle getNextHopHandle()
Returns the next hop handle for this message.

Returns:
The next hop

setNextHopHandle

void setNextHopHandle(NodeHandle nextHop)
Sets the next hop handle for this message

Parameters:
nextHop - The next hop for this handle

getPreviousHopHandle

NodeHandle getPreviousHopHandle()
Gets the previous hop handle for this message.

Returns:
The previous hop.

setPreviousHopHandle

void setPreviousHopHandle(NodeHandle previousHop)
Sets the previous hop handle for this message.

Parameters:
previousHop - The previous hop to Set.

setNewNodeAlongRoute

void setNewNodeAlongRoute(NodeHandle node)
Adds a new node along the current path.

Parameters:
node - the new node to be added.

getRoute

java.util.Collection getRoute()
Returns the route from the source to the destination.

Returns:
returns the route from the source to the destination.

setRoute

void setRoute(java.util.Collection route)
              throws InitializationException
Sets the route for the new path from the source to the destination

Parameters:
route - route from the source to the destination.
Throws:
planet.commonapi.exception.InitializationException.
InitializationException

setTimeToLive

void setTimeToLive(int ttl)
Sets Time to Live For The Message.

Parameters:
ttl - time to live number.

getTimeToLive

int getTimeToLive()
Gets the time to live for the packet.

Returns:
returns the time to live for the packet.

routeMessagesHasExpired

boolean routeMessagesHasExpired()
Returns true if RouteMessage has expired.

Returns:
true if RouteMessage has finished its time to live.

decTimeToLive

void decTimeToLive()
Decreases the Time to Live for the packet.


getMessage

Message getMessage()
Returns the enclosed message inside of this message

Returns:
The enclosed message

getKey

java.lang.String getKey()
Gets the identification key of this communication.

Returns:
Identification key of this communication.

setApplicationId

void setApplicationId(java.lang.String app)
Sets the application name

Parameters:
app - The application name

setDestination

void setDestination(NodeHandle handle)
Sets the destination NodeHandle for this message

Parameters:
handle - The destination NodeHandle

setSource

void setSource(NodeHandle handle)
Sets the source NodeHandle for this message

Parameters:
handle - The source NodeHandle

setMessage

void setMessage(Message message)
Sets the internal message for this message

Parameters:
message - The internal message

setKey

void setKey(java.lang.String key)
Sets the identification key of this communication.

Parameters:
key - key of this communication.

setMode

void setMode(int mode)
Sets the mode of the actual Message. It is required for when a destination of any message is unexisting, the message is automatically returned with mode sets to Globlas.ERROR

Parameters:
mode - The mode of the actual Message.
See Also:
Globals

getType

int getType()
Gets the type of the actual Message.

Returns:
The type of the actual Message.

getMode

int getMode()
Gets the mode of the actual Message.

Returns:
The mode of the actual Message.

setType

void setType(int type)
Sets the type of the actual Message.

Parameters:
type - The type of the actual Message.

setOptions

void setOptions(java.lang.Object o)
Set RouteMessage additional options.

Parameters:
o - additional options.

getOptions

java.lang.Object getOptions()
Returns:
RouteMessage additional options for future use.

setValues

void setValues(java.lang.String appId,
               NodeHandle to,
               NodeHandle from,
               NodeHandle nh,
               Message msg,
               java.lang.String key,
               int type,
               int mode)
Sets all values of the actual RouteMessage, before to be sent.

Parameters:
appId - Identification of the Application which generate this message.
to - Destination Id of this RouteMessage.
from - Source Id of this RouteMessage.
nh - NodeHandle for next hop.
msg - Message wrapped to this RouteMessage.
key - Identification key for this communication with the remote node.
type - Type of this message.
mode - Mode of this message.